diff --git a/platform/viewer/src/components/SidePanel.js b/platform/viewer/src/components/SidePanel.js index 5107f7629..4ee28ddb7 100644 --- a/platform/viewer/src/components/SidePanel.js +++ b/platform/viewer/src/components/SidePanel.js @@ -1,41 +1,36 @@ import './SidePanel.css'; -import React, { Component } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -class SidePanel extends Component { - static propTypes = { - from: PropTypes.string.isRequired, - isOpen: PropTypes.bool.isRequired, - children: PropTypes.node, - width: PropTypes.string, - }; +const SidePanel = ({ from, isOpen, children, width }) => { + const fromSideClass = from === 'right' ? 'from-right' : 'from-left'; - render() { - const fromSideClass = - this.props.from === 'right' ? 'from-right' : 'from-left'; + const styles = width + ? { + maxWidth: width, + marginRight: isOpen ? '0' : Number.parseInt(width) * -1, + } + : {}; - const styles = this.props.width - ? { - maxWidth: this.props.width, - marginRight: this.props.isOpen - ? '0' - : Number.parseInt(this.props.width) * -1, - } - : {}; + return ( +
+ {children} +
+ ); +}; - return ( -
- {this.props.children} -
- ); - } -} +SidePanel.propTypes = { + from: PropTypes.string.isRequired, + isOpen: PropTypes.bool.isRequired, + children: PropTypes.node, + width: PropTypes.string, +}; export default SidePanel;