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

Continuing updating the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
mgabdev
2020-08-18 12:07:47 -05:00
parent 1c2cb6a63a
commit e5f4e12b7b
37 changed files with 834 additions and 931 deletions

View File

@@ -13,42 +13,8 @@ import Responsive from '../../features/ui/util/responsive_component'
const initialState = getWindowDimension()
const messages = defineMessages({
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
delete: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
})
const mapStateToProps = (state) => ({
composeId: state.getIn(['compose', 'id']),
composeText: state.getIn(['compose', 'text']),
})
const mapDispatchToProps = (dispatch) => ({
onOpenModal(type, opts) {
dispatch(openModal(type, opts))
},
onCancelReplyCompose() {
dispatch(cancelReplyCompose())
},
})
export default
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class ModalBase extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
onOpenModal: PropTypes.func.isRequired,
onCancelReplyCompose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
composeId: PropTypes.string,
composeText: PropTypes.string,
type: PropTypes.string,
isCenteredXS: PropTypes.bool,
}
state = {
revealed: !!this.props.children,
width: initialState.width,
@@ -188,4 +154,37 @@ class ModalBase extends React.PureComponent {
)
}
}
}
const messages = defineMessages({
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
delete: { id: 'confirmations.delete.message', defaultMessage: 'Are you sure you want to delete this status?' },
})
const mapStateToProps = (state) => ({
composeId: state.getIn(['compose', 'id']),
composeText: state.getIn(['compose', 'text']),
})
const mapDispatchToProps = (dispatch) => ({
onOpenModal(type, opts) {
dispatch(openModal(type, opts))
},
onCancelReplyCompose() {
dispatch(cancelReplyCompose())
},
})
ModalBase.propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
onOpenModal: PropTypes.func.isRequired,
onCancelReplyCompose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
composeId: PropTypes.string,
composeText: PropTypes.string,
type: PropTypes.string,
isCenteredXS: PropTypes.bool,
}
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ModalBase))