Continuing updating the reformatting of propTypes and set redux, intl functions to end of component

• Removing:
- the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
mgabdev
2020-08-17 19:57:35 -05:00
parent 46a0cbca7d
commit ddca693cfc
101 changed files with 2053 additions and 2140 deletions

View File

@@ -13,40 +13,12 @@ import {
} from '../actions/search'
import Button from './button'
const mapStateToProps = (state) => ({
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted']),
theme: state.getIn(['settings', 'displayOptions', 'theme']),
})
const mapDispatchToProps = (dispatch) => ({
onChange: (value) => dispatch(changeSearch(value)),
onClear: () => dispatch(clearSearch()),
onSubmit: () => dispatch(submitSearch()),
onShow: () => dispatch(showSearch()),
})
export default
@withRouter
@connect(mapStateToProps, mapDispatchToProps)
class Search extends React.PureComponent {
static contextTypes = {
router: PropTypes.object.isRequired,
}
static propTypes = {
value: PropTypes.string.isRequired,
submitted: PropTypes.bool,
onShow: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
withOverlay: PropTypes.bool,
onClear: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isInNav: PropTypes.bool.isRequired,
theme: PropTypes.string,
}
state = {
focused: false,
}
@@ -176,4 +148,31 @@ class Search extends React.PureComponent {
)
}
}
}
const mapStateToProps = (state) => ({
value: state.getIn(['search', 'value']),
submitted: state.getIn(['search', 'submitted']),
theme: state.getIn(['settings', 'displayOptions', 'theme']),
})
const mapDispatchToProps = (dispatch) => ({
onChange: (value) => dispatch(changeSearch(value)),
onClear: () => dispatch(clearSearch()),
onSubmit: () => dispatch(submitSearch()),
onShow: () => dispatch(showSearch()),
})
Search.propTypes = {
value: PropTypes.string.isRequired,
submitted: PropTypes.bool,
onShow: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
withOverlay: PropTypes.bool,
onClear: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
isInNav: PropTypes.bool.isRequired,
theme: PropTypes.string,
}
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Search))