gab-social/app/javascript/gabsocial/layouts/group_layout.js

95 lines
2.7 KiB
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
2020-02-28 15:20:47 +00:00
import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import Sticky from 'react-stickynode'
2020-05-09 03:17:19 +01:00
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
2020-04-11 23:29:19 +01:00
import Layout from './layout'
import GroupHeader from '../components/group_header'
import SidebarPanelGroup from '../components/sidebar_panel_group'
import Responsive from '../features/ui/util/responsive_component'
import WrappedBundle from '../features/ui/util/wrapped_bundle'
import {
LinkFooter,
SignUpPanel,
GroupsPanel,
GroupInfoPanel,
} from '../features/ui/util/async_components'
2020-02-28 15:20:47 +00:00
class GroupLayout extends ImmutablePureComponent {
2020-02-28 15:20:47 +00:00
render() {
2020-04-11 23:29:19 +01:00
const {
children,
2020-05-03 06:22:49 +01:00
group,
groupId,
2020-04-11 23:29:19 +01:00
relationships,
2020-05-03 06:22:49 +01:00
title,
2020-04-11 23:29:19 +01:00
} = this.props
2020-02-29 15:42:47 +00:00
2020-02-28 15:20:47 +00:00
return (
2020-04-11 23:29:19 +01:00
<Layout
noRightSidebar
showBackBtn
2020-05-03 06:22:49 +01:00
title={title}
page='group'
2020-04-11 23:29:19 +01:00
>
2020-05-09 03:17:19 +01:00
<Responsive max={BREAKPOINT_EXTRA_SMALL}>
<div className={[_s.d, _s.w100PC].join(' ')}>
2020-04-11 23:29:19 +01:00
<GroupHeader group={group} relationships={relationships} isXS>
<WrappedBundle component={GroupInfoPanel} componentParams={{ group, noPanel: true }} />
2020-05-09 03:17:19 +01:00
</GroupHeader>
2020-04-11 23:29:19 +01:00
<div className={[_s.d, _s.w100PC, _s.z1].join(' ')}>
2020-05-09 03:17:19 +01:00
{children}
2020-02-28 15:20:47 +00:00
</div>
2020-05-09 03:17:19 +01:00
</div>
</Responsive>
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
<div className={[_s.d, _s.w100PC, _s.pl15].join(' ')}>
2020-05-09 03:17:19 +01:00
<GroupHeader group={group} relationships={relationships} />
<div className={[_s.d, _s.flexRow, _s.w100PC, _s.jcEnd].join(' ')}>
<div className={[_s.d, _s.w645PX, _s.z1].join(' ')}>
<div className={_s.d}>
2020-05-09 03:17:19 +01:00
{children}
2020-02-29 15:42:47 +00:00
</div>
2020-05-09 03:17:19 +01:00
</div>
<div className={[_s.d, _s.ml15, _s.w340PX].join(' ')}>
2020-05-09 03:17:19 +01:00
<Sticky top={73} enabled>
<div className={[_s.d, _s.w340PX].join(' ')}>
<SidebarPanelGroup
page={`group.${groupId}`}
layout={[
<WrappedBundle component={GroupInfoPanel} componentParams={{ group }} />,
SignUpPanel,
GroupsPanel,
LinkFooter,
]}
/>
2020-05-09 03:17:19 +01:00
</div>
</Sticky>
</div>
2020-02-28 15:20:47 +00:00
</div>
</div>
2020-05-09 03:17:19 +01:00
</Responsive>
2020-04-11 23:29:19 +01:00
</Layout>
2020-02-28 15:20:47 +00:00
)
}
}
GroupLayout.propTypes = {
children: PropTypes.node,
group: ImmutablePropTypes.map,
groupId: PropTypes.string,
relationships: ImmutablePropTypes.map,
title: PropTypes.string,
}
export default GroupLayout