diff --git a/src/common/buttons/action-board-button-group.js b/src/common/buttons/action-board-button-group.js new file mode 100644 index 0000000..4ec9485 --- /dev/null +++ b/src/common/buttons/action-board-button-group.js @@ -0,0 +1,121 @@ +/** + * This file is part of VILLASweb. + * + * VILLASweb is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * VILLASweb is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with VILLASweb. If not, see . + ******************************************************************************/ + +import React from 'react'; +import PropTypes from 'prop-types'; +import IconButton from './icon-button'; +import IconToggleButton from './icon-toggle-button'; + +const buttonStyle = { + marginLeft: '12px', + height: '44px', + width: '35px', + alignItems: 'center', + justifyContent: 'center', + display: 'inline-flex' +}; + +const iconStyle = { + height: '20px', + width: '20px' +} + +let buttonkey = 0; + +class ActionBoardButtonGroup extends React.Component { + + getBtn(icon, tooltip, clickFn, disabled = false) { + return + } + + getToggleBtn(checkedIcon, uncheckedIcon, tooltipChecked, tooltipUnchecked, clickFn, checked = false, disabled = false) { + return + } + + render() { + const buttons = []; + buttonkey = 0; + let disabled = this.props.disabled ? this.props.disabled : false; + + if (this.props.onReset) { + buttons.push(this.getBtn("undo", "Reset", this.props.onReset, disabled)); + } + + if (this.props.onRecreate) { + buttons.push(this.getBtn("redo", "Recreate", this.props.onRecreate, disabled)); + } + + if (this.props.onShutdown) { + buttons.push(this.getBtn("power-off", "Shutdown", this.props.onShutdown, disabled)); + } + + if (this.props.onDelete) { + buttons.push(this.getBtn("trash", "Delete", this.props.onDelete, disabled)); + } + + if (this.props.onStart) { + buttons.push(this.getBtn("play", "Start", this.props.onStart, disabled)); + } + + if (this.props.onPauseResume) { + buttons.push(this.getToggleBtn("pause", "pause", "click to resume", "click to pause", this.props.onPauseResume, this.props.paused, disabled)); + } + + if (this.props.onStop) { + buttons.push(this.getBtn("stop", "Stop", this.props.onStop, disabled)); + } + + return
+ {buttons} +
; + } +} + +ActionBoardButtonGroup.propTypes = { + onReset: PropTypes.func, + onShutdown: PropTypes.func, + onDelete: PropTypes.func, + onRecreate: PropTypes.func, + onStart: PropTypes.func, + onStop: PropTypes.func, + onPauseResume: PropTypes.func +}; + +export default ActionBoardButtonGroup;