From ad8b8d68fff95e236f613f5ff60e7e9e963b3f2d Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Fri, 14 Aug 2020 12:47:10 -0500 Subject: [PATCH] Updated Display container component structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - Display container component structure --- .../gabsocial/containers/display.js | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) 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