diff options
Diffstat (limited to 'app/javascript/mastodon/components/column_collapsable.js')
-rw-r--r-- | app/javascript/mastodon/components/column_collapsable.js | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/app/javascript/mastodon/components/column_collapsable.js b/app/javascript/mastodon/components/column_collapsable.js index 797946859..3154c977f 100644 --- a/app/javascript/mastodon/components/column_collapsable.js +++ b/app/javascript/mastodon/components/column_collapsable.js @@ -4,16 +4,19 @@ import PropTypes from 'prop-types'; class ColumnCollapsable extends React.PureComponent { - constructor (props, context) { - super(props, context); - this.state = { - collapsed: true - }; - - this.handleToggleCollapsed = this.handleToggleCollapsed.bind(this); - } - - handleToggleCollapsed () { + static propTypes = { + icon: PropTypes.string.isRequired, + title: PropTypes.string, + fullHeight: PropTypes.number.isRequired, + children: PropTypes.node, + onCollapse: PropTypes.func + }; + + state = { + collapsed: true + }; + + handleToggleCollapsed = () => { const currentState = this.state.collapsed; this.setState({ collapsed: !currentState }); @@ -46,12 +49,4 @@ class ColumnCollapsable extends React.PureComponent { } } -ColumnCollapsable.propTypes = { - icon: PropTypes.string.isRequired, - title: PropTypes.string, - fullHeight: PropTypes.number.isRequired, - children: PropTypes.node, - onCollapse: PropTypes.func -}; - export default ColumnCollapsable; |