gab-social/app/javascript/gabsocial/pages/compose_page.js
mgabdev 152e59a66f Updated all components that implement window resize to use redux dimensions
• Updated:
- all components that implement window resize to use redux dimensions
2021-01-08 00:15:53 -05:00

41 lines
984 B
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import PageTitle from '../features/ui/util/page_title'
import ComposeLayout from '../layouts/compose_layout'
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
class ComposePage extends React.PureComponent {
componentDidMount() {
window.addEventListener('keyup', this.handleKeyUp, false)
}
componentWillUnmount() {
window.removeEventListener('keyup', this.handleKeyUp)
}
render() {
const { children, width } = this.props
const isXS = width <= BREAKPOINT_EXTRA_SMALL
return (
<ComposeLayout title='Compose' isXS={isXS}>
<PageTitle path='Compose' />
{children}
</ComposeLayout>
)
}
}
const mapStateToProps = (state) => ({
width: state.getIn(['settings', 'window_dimensions', 'width']),
})
ComposePage.propTypes = {
children: PropTypes.node.isRequired,
}
export default connect(mapStateToProps)(ComposePage)