gab-social/app/javascript/gabsocial/components/timeline_compose_block.js

77 lines
2.4 KiB
JavaScript
Raw Normal View History

2020-02-21 00:57:29 +00:00
import ImmutablePureComponent from 'react-immutable-pure-component'
import ImmutablePropTypes from 'react-immutable-proptypes'
import { injectIntl, defineMessages } from 'react-intl'
import { me } from '../initial_state'
2020-05-07 05:03:34 +01:00
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
2020-02-21 00:57:29 +00:00
import ComposeFormContainer from '../features/compose/containers/compose_form_container'
2020-05-06 05:33:54 +01:00
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
2020-05-07 05:03:34 +01:00
import Responsive from '../features/ui/util/responsive_component'
2020-03-31 17:04:50 +01:00
import Avatar from './avatar'
2020-02-21 00:57:29 +00:00
import Heading from './heading'
const messages = defineMessages({
createPost: { id: 'column_header.create_post', defaultMessage: 'Create Post' },
})
2019-08-13 16:54:29 +01:00
2020-04-11 23:29:19 +01:00
const mapStateToProps = (state) => ({
account: state.getIn(['accounts', me]),
})
2019-08-13 16:54:29 +01:00
2020-02-21 00:57:29 +00:00
export default
@connect(mapStateToProps)
@injectIntl
2019-08-13 16:54:29 +01:00
class TimelineComposeBlock extends ImmutablePureComponent {
static propTypes = {
2020-02-21 00:57:29 +00:00
intl: PropTypes.object.isRequired,
2019-08-13 16:54:29 +01:00
account: ImmutablePropTypes.map.isRequired,
size: PropTypes.number,
2020-03-07 04:53:28 +00:00
modal: PropTypes.bool,
2019-08-13 16:54:29 +01:00
}
static defaultProps = {
size: 32,
}
render() {
2020-03-07 04:53:28 +00:00
const {
account,
size,
intl,
modal,
...rest
} = this.props
if (modal) {
return (
<section className={_s.default}>
<div className={[_s.default, _s.flexRow].join(' ')}>
2020-06-17 18:25:10 +01:00
<ComposeFormContainer {...rest} modal={modal} />
2020-03-07 04:53:28 +00:00
</div>
</section>
)
}
2019-08-13 16:54:29 +01:00
return (
2020-03-11 23:56:18 +00:00
<section className={[_s.default, _s.mb15].join(' ')}>
2020-05-06 05:33:54 +01:00
<ResponsiveClassesComponent
classNames={[_s.default, _s.boxShadowBlock, _s.bgPrimary, _s.overflowHidden, _s.radiusSmall].join(' ')}
classNamesXS={[_s.default, _s.boxShadowBlock, _s.bgPrimary, _s.overflowHidden].join(' ')}
>
2020-05-07 05:03:34 +01:00
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
<div className={[_s.default, _s.bgSubtle, _s.borderTop1PX, _s.borderBottom1PX, _s.borderColorSecondary, _s.px15, _s.py2, _s.alignItemsCenter, _s.flexRow].join(' ')}>
<div className={_s.mr10}>
<Avatar account={account} size={20} noHover />
</div>
<Heading size='h5'>
{intl.formatMessage(messages.createPost)}
</Heading>
2020-03-31 17:04:50 +01:00
</div>
2020-05-07 05:03:34 +01:00
</Responsive>
2020-04-02 04:17:21 +01:00
<ComposeFormContainer {...rest} />
2020-05-06 05:33:54 +01:00
</ResponsiveClassesComponent>
2020-02-08 22:57:09 +00:00
</section>
2019-08-13 16:54:29 +01:00
)
}
}