Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #81 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
andreiggr committed Oct 4, 2022
2 parents 57bb5b5 + 8de0897 commit 96ee979
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 6 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [0.2.19](https://github.com/eea/volto-forests-theme/compare/0.2.18...0.2.19) - 19 September 2022
### [0.2.20](https://github.com/eea/volto-forests-theme/compare/0.2.19...0.2.20) - 4 October 2022

#### :hammer_and_wrench: Others

- Retouch homepage print style [andreiggr - [`f1dd3e9`](https://github.com/eea/volto-forests-theme/commit/f1dd3e91866f02353543ded4de15efeeb8f0dc82)]
- add integration [andreiggr - [`ad9986d`](https://github.com/eea/volto-forests-theme/commit/ad9986d01f22661f7c7e5e8722b1c56ccb68ea68)]
- stylewrapper [andreiggr - [`46db3f2`](https://github.com/eea/volto-forests-theme/commit/46db3f23d71d7134b9a283814501157338d176a6)]
- use specific volto alpha version for testing [andreiggr - [`8ab409e`](https://github.com/eea/volto-forests-theme/commit/8ab409ebdc8684d388dbc2b8547f47c42b9a0428)]
- use custom renderblocks until slate integration [andreiggr - [`b626491`](https://github.com/eea/volto-forests-theme/commit/b626491174d610f404151994e8577573026efa0a)]
- Don't set color to header elements in columns-view [andreiggr - [`f8d8289`](https://github.com/eea/volto-forests-theme/commit/f8d82891b953936e08592b99479f869cee5908ff)]
### [0.2.19](https://github.com/eea/volto-forests-theme/compare/0.2.18...0.2.19) - 19 September 2022

### [0.2.18](https://github.com/eea/volto-forests-theme/compare/0.2.17...0.2.18) - 13 September 2022

#### :hammer_and_wrench: Others
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline {
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu"
DEPENDENCIES = ""
VOLTO = "alpha"
VOLTO = "16.0.0-alpha.14"
}

stages {
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/blocks-basics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
describe('Blocks Tests', () => {
it('Add Blocks: Empty', () => {});
});
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-forests-theme",
"version": "0.2.19",
"version": "0.2.20",
"description": "@eeacms/volto-forests-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down Expand Up @@ -39,7 +39,8 @@
"devDependencies": {
"@cypress/code-coverage": "^3.9.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"cypress": "10.7.0"
"cypress": "10.7.0",
"md5": "^2.3.0"
},
"scripts": {
"release": "release-it",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import cx from 'classnames';
import { buildStyleClassNamesFromData } from '@plone/volto/helpers';

const StyleWrapper = (props) => {
const { children, data = {} } = props;
const styles = buildStyleClassNamesFromData(data.styles);
const rewrittenChildren = React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
const childProps = {
...props,
className: cx([child.props.className, ...styles]),
};
return React.cloneElement(child, childProps);
}
return child;
});

return rewrittenChildren;
};

export default StyleWrapper;
65 changes: 65 additions & 0 deletions src/customizations/volto/components/theme/View/RenderBlocks.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react';
import { getBaseUrl, applyBlockDefaults } from '@plone/volto/helpers';
import { defineMessages, injectIntl } from 'react-intl';
import { map } from 'lodash';
import {
getBlocksFieldname,
getBlocksLayoutFieldname,
hasBlocksData,
} from '@plone/volto/helpers';
import config from '@plone/volto/registry';
import StyleWrapper from '../../manage/Blocks/Block/StyleWrapper';

const messages = defineMessages({
unknownBlock: {
id: 'Unknown Block',
defaultMessage: 'Unknown Block {block}',
},
});

const RenderBlocks = (props) => {
const { content, intl, location, metadata } = props;
const blocksFieldname = getBlocksFieldname(content);
const blocksLayoutFieldname = getBlocksLayoutFieldname(content);
const blocksConfig = props.blocksConfig || config.blocks.blocksConfig;
const CustomTag = props.as || React.Fragment;

return hasBlocksData(content) ? (
<CustomTag>
{map(content[blocksLayoutFieldname].items, (block) => {
const Block =
blocksConfig[content[blocksFieldname]?.[block]?.['@type']]?.view;

const blockData = applyBlockDefaults({
data: content[blocksFieldname][block],
intl,
metadata,
properties: content,
});

return Block ? (
<StyleWrapper key={block} {...props} id={block} data={blockData}>
<Block
id={block}
metadata={metadata}
properties={content}
data={blockData}
path={getBaseUrl(location?.pathname || '')}
blocksConfig={blocksConfig}
/>
</StyleWrapper>
) : (
<div key={block}>
{intl.formatMessage(messages.unknownBlock, {
block: content[blocksFieldname]?.[block]?.['@type'],
})}
</div>
);
})}
</CustomTag>
) : (
''
);
};

export default injectIntl(RenderBlocks);
1 change: 0 additions & 1 deletion theme/site/globals/site.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,6 @@ span.float-right {
.block-container,
.columns-view {
h5 {
color: @darkBrown;
font-weight: bold;
text-transform: uppercase;
}
Expand Down

0 comments on commit 96ee979

Please sign in to comment.