gab-social/app/javascript/gabsocial/pages/compose_page.js

41 lines
984 B
JavaScript
Raw Normal View History

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