Updated Display container component structure
• Updated: - Display container component structure
This commit is contained in:
parent
3369f559a7
commit
ad8b8d68ff
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
Loading…
Reference in New Issue
Block a user