-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#806 Support bottom panel that appears between the paletter and right… (
#807)
- Loading branch information
Showing
12 changed files
with
326 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
canvas_modules/common-canvas/src/common-canvas/cc-bottom-panel.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2017-2020 Elyra Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* eslint no-shadow: ["error", { "allow": ["Node", "Comment"] }] */ | ||
|
||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { connect } from "react-redux"; | ||
import { injectIntl } from "react-intl"; | ||
import Logger from "../logging/canvas-logger.js"; | ||
|
||
class CanvasBottomPanel extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
panelHeight: 393 | ||
}; | ||
|
||
this.resizing = false; | ||
this.logger = new Logger("CC-Bottom-Panel"); | ||
|
||
this.startResize = this.startResize.bind(this); | ||
this.stopResize = this.stopResize.bind(this); | ||
this.resize = this.resize.bind(this); | ||
} | ||
|
||
componentDidMount() { | ||
// document.addEventListener("mouseup", this.stopResize, true); | ||
} | ||
|
||
componentWillUnmount() { | ||
// document.removeEventListener("mouseup", this.stopResize, true); | ||
} | ||
|
||
startResize(evt) { | ||
this.resizing = true; | ||
} | ||
|
||
stopResize(evt) { | ||
this.resizing = false; | ||
} | ||
|
||
resize(evt) { | ||
if (this.resizing) { | ||
this.setState({ "panelHeight": this.state.panelHeight + evt.movementY }); | ||
} | ||
} | ||
|
||
render() { | ||
this.logger.log("render"); | ||
|
||
let bottomPanel = null; | ||
|
||
const styleObj = { | ||
height: this.state.panelHeight + "px" | ||
// transition: transitionVariable, | ||
}; | ||
|
||
if (this.props.bottomPanelIsOpen) { | ||
bottomPanel = ( | ||
<div className={"bottom-panel"} style={styleObj}> | ||
{this.props.bottomPanelContent} | ||
</div> | ||
); | ||
} | ||
|
||
return bottomPanel; | ||
} | ||
} | ||
|
||
CanvasBottomPanel.propTypes = { | ||
// Provided by CommonCanvas | ||
intl: PropTypes.object.isRequired, | ||
canvasController: PropTypes.object.isRequired, | ||
|
||
// Provided by Redux | ||
bottomPanelIsOpen: PropTypes.bool, | ||
bottomPanelContent: PropTypes.object | ||
}; | ||
|
||
const mapStateToProps = (state, ownProps) => ({ | ||
bottomPanelIsOpen: state.bottompanel.isOpen, | ||
bottomPanelContent: state.bottompanel.content | ||
}); | ||
|
||
export default connect(mapStateToProps)(injectIntl(CanvasBottomPanel)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
canvas_modules/common-canvas/src/object-model/redux/reducers/bottompanel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2021 Elyra Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export default (state = {}, action) => { | ||
switch (action.type) { | ||
case "SET_BOTTOM_PANEL_CONFIG": { | ||
if (action.data.config) { | ||
return { | ||
content: action.data.config.content, | ||
isOpen: action.data.config.isOpen }; | ||
} | ||
return state; | ||
} | ||
|
||
default: | ||
return state; | ||
} | ||
}; |
Oops, something went wrong.