@kitconcept/volto-light-theme 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -0
- package/.editorconfig +36 -0
- package/.eslintignore +2 -0
- package/.eslintrc.local.js +50 -0
- package/.github/workflows/changelog.yml +43 -0
- package/.github/workflows/code.yml +15 -0
- package/.github/workflows/unit.yml +15 -0
- package/.prettierignore +3 -0
- package/.release-it.json +19 -0
- package/.stylelintrc +33 -0
- package/.yarn/releases/yarn-3.2.3.cjs +783 -0
- package/.yarnrc.yml +3 -0
- package/CHANGELOG.md +80 -0
- package/Makefile +129 -0
- package/README.md +133 -0
- package/acceptance/.gitkeep +0 -0
- package/acceptance/ci.yml +29 -0
- package/acceptance/cypress/.gitkeep +0 -0
- package/acceptance/cypress/fixtures/broccoli.jpg +0 -0
- package/acceptance/cypress/fixtures/example.json +5 -0
- package/acceptance/cypress/fixtures/file.pdf +0 -0
- package/acceptance/cypress/fixtures/image.png +0 -0
- package/acceptance/cypress/plugins/index.js +17 -0
- package/acceptance/cypress/support/commands.js +1 -0
- package/acceptance/cypress/support/e2e.js +14 -0
- package/acceptance/cypress/support/reset-fixture.js +45 -0
- package/acceptance/cypress/support/slate.js +14 -0
- package/acceptance/cypress/tests/.gitkeep +0 -0
- package/acceptance/cypress/tests/basic.cy.js +71 -0
- package/acceptance/cypress.config.js +9 -0
- package/acceptance/docker-compose.yml +57 -0
- package/acceptance/package.json +5 -0
- package/acceptance/yarn.lock +2597 -0
- package/dockerfiles/Dockerfile +24 -0
- package/dockerfiles/Dockerfile.acceptance +13 -0
- package/dockerfiles/Dockerfile.dev +20 -0
- package/dockerfiles/docker-compose.yml +33 -0
- package/locales/de/LC_MESSAGES/volto.po +68 -0
- package/locales/en/LC_MESSAGES/volto.po +62 -0
- package/locales/volto.pot +64 -0
- package/news/.gitkeep +0 -0
- package/package.json +55 -0
- package/src/components/Anontools/Anontools.jsx +79 -0
- package/src/components/Atoms/Container/Container.jsx +28 -0
- package/src/components/Atoms/helpers.jsx +9 -0
- package/src/components/Blocks/Accordion/schema.jsx +11 -0
- package/src/components/Blocks/Button/schema.js +28 -0
- package/src/components/Blocks/Listing/GridTemplate.jsx +80 -0
- package/src/components/Blocks/Listing/SummaryTemplate.jsx +66 -0
- package/src/components/Blocks/Search/TopSideFacets.jsx +159 -0
- package/src/components/Blocks/Slate/ExtraAlignWrapper.js +22 -0
- package/src/components/Blocks/Teaser/schema.js +5 -0
- package/src/components/Blocks/schema.js +38 -0
- package/src/components/Breadcrumbs/Breadcrumbs.jsx +117 -0
- package/src/components/CQPolyfill.jsx +9 -0
- package/src/components/Footer/Footer.jsx +131 -0
- package/src/components/Header/Header.jsx +64 -0
- package/src/components/Logo/Logo.jsx +39 -0
- package/src/components/Navigation/Navigation.jsx +199 -0
- package/src/components/SearchWidget/SearchWidget.jsx +173 -0
- package/src/components/Widgets/AlignWidget.jsx +80 -0
- package/src/customizations/@root/theme.js +5 -0
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +44 -0
- package/src/customizations/volto/components/manage/Blocks/Listing/DefaultTemplate.jsx +47 -0
- package/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx +11 -0
- package/src/customizations/volto/components/manage/Blocks/Search/components/SearchDetails.jsx +33 -0
- package/src/customizations/volto/components/manage/Blocks/Search/components/SearchInput.jsx +56 -0
- package/src/customizations/volto/components/manage/Form/Form.jsx +803 -0
- package/src/customizations/volto/components/theme/Anontools/Anontools.jsx +11 -0
- package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +11 -0
- package/src/customizations/volto/components/theme/Footer/Footer.jsx +11 -0
- package/src/customizations/volto/components/theme/Header/Header.jsx +11 -0
- package/src/customizations/volto/components/theme/Logo/Logo.jsx +11 -0
- package/src/customizations/volto/components/theme/Navigation/Navigation.jsx +11 -0
- package/src/customizations/volto/components/theme/SearchWidget/SearchWidget.jsx +11 -0
- package/src/customizations/volto/components/theme/View/RenderBlocks.jsx +164 -0
- package/src/customizations/volto/components/theme/View/RenderBlocks.test.jsx +308 -0
- package/src/icons/block_icn_accordion.svg +1 -0
- package/src/icons/block_icn_grid.svg +1 -0
- package/src/index.js +239 -0
- package/src/static/container-query-polyfill.modern.js +1 -0
- package/src/theme/_bgcolor-blocks-layout.scss +47 -0
- package/src/theme/_breadcrumbs.scss +39 -0
- package/src/theme/_content.scss +7 -0
- package/src/theme/_footer.scss +44 -0
- package/src/theme/_header.scss +253 -0
- package/src/theme/_layout.scss +271 -0
- package/src/theme/_temp.scss +2 -0
- package/src/theme/_toolbar.scss +3 -0
- package/src/theme/_typo-custom.scss +193 -0
- package/src/theme/_typography.scss +271 -0
- package/src/theme/_utils.scss +43 -0
- package/src/theme/_variables.scss +254 -0
- package/src/theme/atoms/_container.scss +11 -0
- package/src/theme/blocks/_accordion.scss +4 -0
- package/src/theme/blocks/_button.scss +29 -0
- package/src/theme/blocks/_grid.scss +242 -0
- package/src/theme/blocks/_highlight.scss +11 -0
- package/src/theme/blocks/_image.scss +357 -0
- package/src/theme/blocks/_introduction.scss +27 -0
- package/src/theme/blocks/_listing.scss +77 -0
- package/src/theme/blocks/_search.scss +168 -0
- package/src/theme/blocks/_separator.scss +13 -0
- package/src/theme/blocks/_slate.scss +5 -0
- package/src/theme/blocks/_slider.scss +135 -0
- package/src/theme/blocks/_teaser.scss +109 -0
- package/src/theme/blocks/_toc.scss +9 -0
- package/src/theme/collections/grid.variables +2 -0
- package/src/theme/custom/_main.scss +2 -0
- package/src/theme/custom/_variables.scss +2 -0
- package/src/theme/extras/README.md +8 -0
- package/src/theme/extras/custom.less +2 -0
- package/src/theme/extras/custom.overrides +3 -0
- package/src/theme/fonts/Inter-Black.ttf +0 -0
- package/src/theme/fonts/Inter-Bold.ttf +0 -0
- package/src/theme/fonts/Inter-ExtraBold.ttf +0 -0
- package/src/theme/fonts/Inter-ExtraLight.ttf +0 -0
- package/src/theme/fonts/Inter-Light.ttf +0 -0
- package/src/theme/fonts/Inter-Medium.ttf +0 -0
- package/src/theme/fonts/Inter-Regular.ttf +0 -0
- package/src/theme/fonts/Inter-SemiBold.ttf +0 -0
- package/src/theme/fonts/Inter-Thin.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Black.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Black.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Black.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Black.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BlackItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BlackItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BlackItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BlackItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Bold.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Bold.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Bold.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Bold.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BoldItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BoldItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BoldItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-BoldItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBold.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBold.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBold.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBold.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBoldItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBoldItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBoldItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraBoldItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLight.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLight.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLight.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLight.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLightItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLightItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLightItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ExtraLightItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Light.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Light.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Light.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Light.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-LightItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-LightItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-LightItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-LightItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Medium.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Medium.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Medium.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Medium.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-MediumItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-MediumItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-MediumItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-MediumItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Regular.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Regular.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Regular.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Regular.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-RegularItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-RegularItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-RegularItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-RegularItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBold.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBold.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBold.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBold.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBoldItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBoldItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBoldItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-SemiBoldItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Thin.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Thin.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Thin.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-Thin.woff2 +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ThinItalic.eot +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ThinItalic.ttf +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ThinItalic.woff +0 -0
- package/src/theme/fonts/metropolis/Metropolis-ThinItalic.woff2 +0 -0
- package/src/theme/fonts/metropolis/demo.html +685 -0
- package/src/theme/fonts/metropolis/stylesheet.css +217 -0
- package/src/theme/globals/site.variables +64 -0
- package/src/theme/main.scss +33 -0
- package/src/theme/theme.config +88 -0
- package/towncrier.toml +33 -0
- package/volto.config.js +7 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Anontools.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Anontools from '../../../../../components/Anontools/Anontools';
|
|
10
|
+
|
|
11
|
+
export default Anontools;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Breadcrumbs.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Breadcrumbs from '../../../../../components/Breadcrumbs/Breadcrumbs';
|
|
10
|
+
|
|
11
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Footer.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Footer from '../../../../../components/Footer/Footer';
|
|
10
|
+
|
|
11
|
+
export default Footer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Header.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Header from '../../../../../components/Header/Header';
|
|
10
|
+
|
|
11
|
+
export default Header;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Logo.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Logo from '../../../../../components/Logo/Logo';
|
|
10
|
+
|
|
11
|
+
export default Logo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE Navigation.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import Navigation from '../../../../../components/Navigation/Navigation';
|
|
10
|
+
|
|
11
|
+
export default Navigation;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE SearchWidget.jsx
|
|
3
|
+
* REASON: This theme uses a custom pre-@plone/components component
|
|
4
|
+
* SemanticUI-free located at the components folder.
|
|
5
|
+
* To override it, override the @kitconcept/volto-light-theme one instead of
|
|
6
|
+
* this one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import SearchWidget from '../../../../../components/SearchWidget/SearchWidget';
|
|
10
|
+
|
|
11
|
+
export default SearchWidget;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OVERRIDE RenderBlocks.jsx
|
|
3
|
+
* REASON: This version enables auto-grouping of blocks that share the same style property
|
|
4
|
+
* in the StylingWrapper. In the future one could improve it by enabling a way to choose the
|
|
5
|
+
* grouping property, eg. using a property other than `backgroundColor`.
|
|
6
|
+
* FILE: https://github.com/plone/volto/blob/9882c66da42e5440ca1c949d829b78f2b1328683/src/components/theme/View/RenderBlocks.jsx#L25
|
|
7
|
+
* FILE VERSION: Volto 17.0.0-alpha.16
|
|
8
|
+
* DATE: 2023-06-28
|
|
9
|
+
* DEVELOPER: @sneridagh
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { getBaseUrl, applyBlockDefaults } from '@plone/volto/helpers';
|
|
14
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
15
|
+
import { map } from 'lodash';
|
|
16
|
+
import {
|
|
17
|
+
getBlocksFieldname,
|
|
18
|
+
getBlocksLayoutFieldname,
|
|
19
|
+
hasBlocksData,
|
|
20
|
+
} from '@plone/volto/helpers';
|
|
21
|
+
import StyleWrapper from '@plone/volto/components/manage/Blocks/Block/StyleWrapper';
|
|
22
|
+
import config from '@plone/volto/registry';
|
|
23
|
+
import { ViewDefaultBlock } from '@plone/volto/components';
|
|
24
|
+
import cx from 'classnames';
|
|
25
|
+
import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
|
|
26
|
+
import RenderEmptyBlock from '@plone/volto/components/theme/View/RenderEmptyBlock';
|
|
27
|
+
|
|
28
|
+
const messages = defineMessages({
|
|
29
|
+
unknownBlock: {
|
|
30
|
+
id: 'Unknown Block',
|
|
31
|
+
defaultMessage: 'Unknown Block {block}',
|
|
32
|
+
},
|
|
33
|
+
invalidBlock: {
|
|
34
|
+
id: 'Invalid Block',
|
|
35
|
+
defaultMessage: 'Invalid block - Will be removed on saving',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function groupByBGColor(blocks, blocks_layout) {
|
|
40
|
+
const result = [];
|
|
41
|
+
let currentArr = [];
|
|
42
|
+
let currentBGColor;
|
|
43
|
+
|
|
44
|
+
blocks_layout.items.forEach((blockId) => {
|
|
45
|
+
let currentBlockColor =
|
|
46
|
+
blocks[blockId]?.styles?.backgroundColor ?? 'transparent';
|
|
47
|
+
|
|
48
|
+
if (currentBlockColor !== currentBGColor) {
|
|
49
|
+
currentBGColor = currentBlockColor;
|
|
50
|
+
// write it only if the array has some block inside
|
|
51
|
+
if (currentArr.length > 0) {
|
|
52
|
+
result.push(currentArr);
|
|
53
|
+
currentArr = [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
currentArr.push(blockId);
|
|
58
|
+
});
|
|
59
|
+
result.push(currentArr);
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const RenderBlocks = (props) => {
|
|
64
|
+
const { blockWrapperTag, content, isContainer, location, metadata } = props;
|
|
65
|
+
const intl = useIntl();
|
|
66
|
+
const blocksFieldname = getBlocksFieldname(content);
|
|
67
|
+
const blocksLayoutFieldname = getBlocksLayoutFieldname(content);
|
|
68
|
+
const blocksConfig = props.blocksConfig || config.blocks.blocksConfig;
|
|
69
|
+
const CustomTag = props.as || React.Fragment;
|
|
70
|
+
|
|
71
|
+
const grouped = groupByBGColor(
|
|
72
|
+
content[blocksFieldname],
|
|
73
|
+
content[blocksLayoutFieldname],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return hasBlocksData(content) ? (
|
|
77
|
+
<CustomTag>
|
|
78
|
+
{map(grouped, (group) => (
|
|
79
|
+
<MaybeWrap
|
|
80
|
+
key={`block-group-${group[0]}`}
|
|
81
|
+
condition={
|
|
82
|
+
config.settings.enableAutoBlockGroupingByBackgroundColor &&
|
|
83
|
+
!isContainer
|
|
84
|
+
}
|
|
85
|
+
className={cx(
|
|
86
|
+
'blocks-group-wrapper',
|
|
87
|
+
content[blocksFieldname][group[0]]?.styles?.backgroundColor ??
|
|
88
|
+
'transparent',
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
91
|
+
{map(group, (block) => {
|
|
92
|
+
const Block =
|
|
93
|
+
blocksConfig[content[blocksFieldname]?.[block]?.['@type']]
|
|
94
|
+
?.view || ViewDefaultBlock;
|
|
95
|
+
|
|
96
|
+
const blockData = applyBlockDefaults({
|
|
97
|
+
data: content[blocksFieldname][block],
|
|
98
|
+
intl,
|
|
99
|
+
metadata,
|
|
100
|
+
properties: content,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (content[blocksFieldname]?.[block]?.['@type'] === 'empty') {
|
|
104
|
+
return (
|
|
105
|
+
<MaybeWrap
|
|
106
|
+
key={block}
|
|
107
|
+
condition={blockWrapperTag}
|
|
108
|
+
as={blockWrapperTag}
|
|
109
|
+
>
|
|
110
|
+
<RenderEmptyBlock />
|
|
111
|
+
</MaybeWrap>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (Block) {
|
|
116
|
+
return (
|
|
117
|
+
<MaybeWrap
|
|
118
|
+
key={block}
|
|
119
|
+
condition={blockWrapperTag}
|
|
120
|
+
as={blockWrapperTag}
|
|
121
|
+
>
|
|
122
|
+
<StyleWrapper
|
|
123
|
+
key={block}
|
|
124
|
+
{...props}
|
|
125
|
+
id={block}
|
|
126
|
+
block={block}
|
|
127
|
+
data={blockData}
|
|
128
|
+
>
|
|
129
|
+
<Block
|
|
130
|
+
id={block}
|
|
131
|
+
metadata={metadata}
|
|
132
|
+
properties={content}
|
|
133
|
+
data={blockData}
|
|
134
|
+
path={getBaseUrl(location?.pathname || '')}
|
|
135
|
+
blocksConfig={blocksConfig}
|
|
136
|
+
/>
|
|
137
|
+
</StyleWrapper>
|
|
138
|
+
</MaybeWrap>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (blockData) {
|
|
143
|
+
return (
|
|
144
|
+
<div key={block}>
|
|
145
|
+
{intl.formatMessage(messages.unknownBlock, {
|
|
146
|
+
block: content[blocksFieldname]?.[block]?.['@type'],
|
|
147
|
+
})}
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<div key={block}>{intl.formatMessage(messages.invalidBlock)}</div>
|
|
154
|
+
);
|
|
155
|
+
})}
|
|
156
|
+
</MaybeWrap>
|
|
157
|
+
))}
|
|
158
|
+
</CustomTag>
|
|
159
|
+
) : (
|
|
160
|
+
''
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export default RenderBlocks;
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { groupByBGColor } from './RenderBlocks';
|
|
2
|
+
describe('groupByBGColor', () => {
|
|
3
|
+
it('grid + grid + slate grey', () => {
|
|
4
|
+
const content = {
|
|
5
|
+
blocks: {
|
|
6
|
+
1: {
|
|
7
|
+
'@type': '__grid',
|
|
8
|
+
},
|
|
9
|
+
2: {
|
|
10
|
+
'@type': '__grid',
|
|
11
|
+
},
|
|
12
|
+
3: {
|
|
13
|
+
'@type': 'slate',
|
|
14
|
+
styles: {
|
|
15
|
+
backgroundColor: 'grey',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
blocks_layout: {
|
|
20
|
+
items: [1, 2, 3],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const { blocks, blocks_layout } = content;
|
|
24
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([[1, 2], [3]]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('grid + grid grey + slate grey', () => {
|
|
28
|
+
const content = {
|
|
29
|
+
blocks: {
|
|
30
|
+
1: {
|
|
31
|
+
'@type': '__grid',
|
|
32
|
+
},
|
|
33
|
+
2: {
|
|
34
|
+
'@type': 'slate',
|
|
35
|
+
styles: {
|
|
36
|
+
backgroundColor: 'grey',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
3: {
|
|
40
|
+
'@type': 'slate',
|
|
41
|
+
styles: {
|
|
42
|
+
backgroundColor: 'grey',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
blocks_layout: {
|
|
47
|
+
items: [1, 2, 3],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
const { blocks, blocks_layout } = content;
|
|
51
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([[1], [2, 3]]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('slate grey + slate grey + slate grey ', () => {
|
|
55
|
+
const content = {
|
|
56
|
+
blocks: {
|
|
57
|
+
1: {
|
|
58
|
+
'@type': 'slate',
|
|
59
|
+
styles: {
|
|
60
|
+
backgroundColor: 'grey',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
2: {
|
|
64
|
+
'@type': 'slate',
|
|
65
|
+
styles: {
|
|
66
|
+
backgroundColor: 'grey',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
3: {
|
|
70
|
+
'@type': 'slate',
|
|
71
|
+
styles: {
|
|
72
|
+
backgroundColor: 'grey',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
blocks_layout: {
|
|
77
|
+
items: [1, 2, 3],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const { blocks, blocks_layout } = content;
|
|
81
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([[1, 2, 3]]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('slate grey + slate + slate grey ', () => {
|
|
85
|
+
const content = {
|
|
86
|
+
blocks: {
|
|
87
|
+
1: {
|
|
88
|
+
'@type': 'slate',
|
|
89
|
+
styles: {
|
|
90
|
+
backgroundColor: 'grey',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
2: {
|
|
94
|
+
'@type': 'slate',
|
|
95
|
+
},
|
|
96
|
+
3: {
|
|
97
|
+
'@type': 'slate',
|
|
98
|
+
styles: {
|
|
99
|
+
backgroundColor: 'grey',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
blocks_layout: {
|
|
104
|
+
items: [1, 2, 3],
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const { blocks, blocks_layout } = content;
|
|
108
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([
|
|
109
|
+
[1],
|
|
110
|
+
[2],
|
|
111
|
+
[3],
|
|
112
|
+
]);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('grid + grid + slate grey + slate grey + slate + slate', () => {
|
|
116
|
+
const content = {
|
|
117
|
+
blocks: {
|
|
118
|
+
1: {
|
|
119
|
+
'@type': '__grid',
|
|
120
|
+
},
|
|
121
|
+
2: {
|
|
122
|
+
'@type': '__grid',
|
|
123
|
+
},
|
|
124
|
+
3: {
|
|
125
|
+
'@type': 'slate',
|
|
126
|
+
styles: {
|
|
127
|
+
backgroundColor: 'grey',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
4: {
|
|
131
|
+
'@type': 'slate',
|
|
132
|
+
styles: {
|
|
133
|
+
backgroundColor: 'grey',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
5: {
|
|
137
|
+
'@type': 'slate',
|
|
138
|
+
},
|
|
139
|
+
6: {
|
|
140
|
+
'@type': 'slate',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
blocks_layout: {
|
|
144
|
+
items: [1, 2, 3, 4, 5, 6],
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
const { blocks, blocks_layout } = content;
|
|
148
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([
|
|
149
|
+
[1, 2],
|
|
150
|
+
[3, 4],
|
|
151
|
+
[5, 6],
|
|
152
|
+
]);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('grid + grid + slate grey + slate grey + slate + slate - transparent', () => {
|
|
156
|
+
const content = {
|
|
157
|
+
blocks: {
|
|
158
|
+
1: {
|
|
159
|
+
'@type': '__grid',
|
|
160
|
+
styles: {
|
|
161
|
+
backgroundColor: 'transparent',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
2: {
|
|
165
|
+
'@type': '__grid',
|
|
166
|
+
styles: {
|
|
167
|
+
backgroundColor: 'transparent',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
3: {
|
|
171
|
+
'@type': 'slate',
|
|
172
|
+
styles: {
|
|
173
|
+
backgroundColor: 'grey',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
4: {
|
|
177
|
+
'@type': 'slate',
|
|
178
|
+
styles: {
|
|
179
|
+
backgroundColor: 'grey',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
5: {
|
|
183
|
+
'@type': 'slate',
|
|
184
|
+
styles: {
|
|
185
|
+
backgroundColor: 'transparent',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
6: {
|
|
189
|
+
'@type': 'slate',
|
|
190
|
+
styles: {
|
|
191
|
+
backgroundColor: 'transparent',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
blocks_layout: {
|
|
196
|
+
items: [1, 2, 3, 4, 5, 6],
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
const { blocks, blocks_layout } = content;
|
|
200
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([
|
|
201
|
+
[1, 2],
|
|
202
|
+
[3, 4],
|
|
203
|
+
[5, 6],
|
|
204
|
+
]);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('grid + grid + slate grey + slate grey + slate + slate - transparent mixed', () => {
|
|
208
|
+
const content = {
|
|
209
|
+
blocks: {
|
|
210
|
+
1: {
|
|
211
|
+
'@type': '__grid',
|
|
212
|
+
styles: {
|
|
213
|
+
backgroundColor: 'transparent',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
2: {
|
|
217
|
+
'@type': '__grid',
|
|
218
|
+
styles: {
|
|
219
|
+
backgroundColor: 'transparent',
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
3: {
|
|
223
|
+
'@type': 'slate',
|
|
224
|
+
styles: {
|
|
225
|
+
backgroundColor: 'grey',
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
4: {
|
|
229
|
+
'@type': 'slate',
|
|
230
|
+
styles: {
|
|
231
|
+
backgroundColor: 'grey',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
5: {
|
|
235
|
+
'@type': 'slate',
|
|
236
|
+
},
|
|
237
|
+
6: {
|
|
238
|
+
'@type': 'slate',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
blocks_layout: {
|
|
242
|
+
items: [1, 2, 3, 4, 5, 6],
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
const { blocks, blocks_layout } = content;
|
|
246
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([
|
|
247
|
+
[1, 2],
|
|
248
|
+
[3, 4],
|
|
249
|
+
[5, 6],
|
|
250
|
+
]);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('grid + grid + slate grey + slate grey + slate + slate - transparent mixed', () => {
|
|
254
|
+
const content = {
|
|
255
|
+
blocks: {
|
|
256
|
+
1: {
|
|
257
|
+
'@type': '__grid',
|
|
258
|
+
styles: {
|
|
259
|
+
backgroundColor: 'transparent',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
2: {
|
|
263
|
+
'@type': '__grid',
|
|
264
|
+
},
|
|
265
|
+
3: {
|
|
266
|
+
'@type': '__grid',
|
|
267
|
+
styles: {
|
|
268
|
+
backgroundColor: 'transparent',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
4: {
|
|
272
|
+
'@type': 'slate',
|
|
273
|
+
styles: {
|
|
274
|
+
backgroundColor: 'grey',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
5: {
|
|
278
|
+
'@type': 'slate',
|
|
279
|
+
styles: {
|
|
280
|
+
backgroundColor: 'grey',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
6: {
|
|
284
|
+
'@type': 'slate',
|
|
285
|
+
},
|
|
286
|
+
7: {
|
|
287
|
+
'@type': 'slate',
|
|
288
|
+
},
|
|
289
|
+
8: {
|
|
290
|
+
'@type': 'slate',
|
|
291
|
+
styles: {
|
|
292
|
+
backgroundColor: 'transparent',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
blocks_layout: {
|
|
297
|
+
items: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
const { blocks, blocks_layout } = content;
|
|
301
|
+
|
|
302
|
+
expect(groupByBGColor(blocks, blocks_layout)).toStrictEqual([
|
|
303
|
+
[1, 2, 3],
|
|
304
|
+
[4, 5],
|
|
305
|
+
[6, 7, 8],
|
|
306
|
+
]);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><polygon points="30.16 19.36 33.44 16.03 26.88 16.03 30.16 19.36"/><polygon points="30.09 8.02 26.88 11.35 33.44 11.35 30.09 8.02"/><polygon points="30.16 27.5 33.44 24.17 26.88 24.17 30.16 27.5"/><polygon points="2.79 12.98 4.79 12.98 4.79 6.68 24.46 6.68 24.46 4.68 2.79 4.68 2.79 12.98"/><polygon points="2.79 21.12 4.79 21.12 4.79 18.03 24.46 18.03 24.46 16.03 2.79 16.03 2.79 21.12"/><polygon points="2.79 28.61 4.79 28.61 4.79 26.17 24.46 26.17 24.46 24.17 2.79 24.17 2.79 28.61"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path d="M25.55,3.83H3.83V32.17H32.17V3.83ZM5.83,30.17V5.83H10V30.17Zm6.2,0V5.83h5V30.17Zm7,0V5.83h4.55V30.17Zm11.17,0H25.55V5.83h4.62Z"/></svg>
|