-
-
Notifications
You must be signed in to change notification settings - Fork 612
/
View.jsx
44 lines (41 loc) · 1.25 KB
/
View.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Grid } from 'semantic-ui-react';
import cx from 'classnames';
import { RenderBlocks } from '@plone/volto/components';
import { withBlockExtensions } from '@plone/volto/helpers';
import config from '@plone/volto/registry';
const GridBlockView = (props) => {
const { data, path, className, style } = props;
const metadata = props.metadata || props.properties;
const columns = data.blocks_layout.items;
const blocksConfig =
config.blocks.blocksConfig[data['@type']].blocksConfig ||
props.blocksConfig;
const location = {
pathname: path,
};
return (
<div
className={cx('block', data['@type'], className, {
one: columns?.length === 1,
two: columns?.length === 2,
three: columns?.length === 3,
four: columns?.length === 4,
})}
style={style}
>
{data.headline && <h2 className="headline">{data.headline}</h2>}
<Grid stackable stretched columns={columns.length}>
<RenderBlocks
{...props}
blockWrapperTag={Grid.Column}
metadata={metadata}
content={data}
location={location}
blocksConfig={blocksConfig}
isContainer
/>
</Grid>
</div>
);
};
export default withBlockExtensions(GridBlockView);