diff --git a/app/javascript/gabsocial/containers/display.js b/app/javascript/gabsocial/containers/display.js index bbd58b70..ee180bc9 100644 --- a/app/javascript/gabsocial/containers/display.js +++ b/app/javascript/gabsocial/containers/display.js @@ -5,24 +5,8 @@ import { DEFAULT_FONT_SIZE, } from '../constants' -const mapStateToProps = (state) => ({ - fontSize: state.getIn(['settings', 'displayOptions', 'fontSize']), - radiusSmallDisabled: state.getIn(['settings', 'displayOptions', 'radiusSmallDisabled']), - radiusCircleDisabled: state.getIn(['settings', 'displayOptions', 'radiusCircleDisabled']), - theme: state.getIn(['settings', 'displayOptions', 'theme']), -}) - -export default -@connect(mapStateToProps) class Display extends PureComponent { - static propTypes = { - fontSize: PropTypes.string.isRequired, - radiusSmallDisabled: PropTypes.bool.isRequired, - radiusCircleDisabled: PropTypes.bool.isRequired, - theme: PropTypes.string.isRequired, - } - state = { theme: this.props.theme, radiusSmallDisabled: this.props.radiusSmallDisabled, @@ -30,13 +14,6 @@ class Display extends PureComponent { fontSize: this.props.fontSize, } - static defaultProps = { - theme: 'light', - radiusSmallDisabled: true, - radiusCircleDisabled: true, - fontSize: 'normal', - } - componentDidMount() { this.updateTheme(this.state.theme) this.updateRadiusSmallDisabled(this.state.radiusSmallDisabled) @@ -116,4 +93,27 @@ class Display extends PureComponent { return this.props.children } -} \ No newline at end of file +} + +const mapStateToProps = (state) => ({ + fontSize: state.getIn(['settings', 'displayOptions', 'fontSize']), + radiusSmallDisabled: state.getIn(['settings', 'displayOptions', 'radiusSmallDisabled']), + radiusCircleDisabled: state.getIn(['settings', 'displayOptions', 'radiusCircleDisabled']), + theme: state.getIn(['settings', 'displayOptions', 'theme']), +}) + +Display.propTypes = { + fontSize: PropTypes.string.isRequired, + radiusSmallDisabled: PropTypes.bool.isRequired, + radiusCircleDisabled: PropTypes.bool.isRequired, + theme: PropTypes.string.isRequired, +} + +Display.defaultProps = { + theme: 'light', + radiusSmallDisabled: true, + radiusCircleDisabled: true, + fontSize: 'normal', +} + +export default connect(mapStateToProps)(Display) \ No newline at end of file