diff --git a/src/components/theme/Homepage/HomePageInverseView.jsx b/src/components/theme/Homepage/HomePageInverseView.jsx new file mode 100644 index 00000000..7c250367 --- /dev/null +++ b/src/components/theme/Homepage/HomePageInverseView.jsx @@ -0,0 +1,60 @@ +/** + * Document view component. + * @module components/theme/View/HomePageInverseView + */ + +import React from 'react'; +import PropTypes from 'prop-types'; + +import { DefaultView } from '@plone/volto/components/'; + +import { BodyClass } from '@plone/volto/helpers'; + +import { hasBlocksData } from '@plone/volto/helpers'; + +/** + * Component to display the default view. + * @function HomePageInverseView + * @param {Object} content Content object. + * @returns {string} Markup of the component. + */ +const HomePageInverseView = ({ content }) => { + return hasBlocksData(content) ? ( + <> + + + + ) : null; +}; + +/** + * Property types. + * @property {Object} propTypes Property types. + * @static + */ +HomePageInverseView.propTypes = { + /** + * Content of the object + */ + content: PropTypes.shape({ + /** + * Title of the object + */ + title: PropTypes.string, + /** + * Description of the object + */ + description: PropTypes.string, + /** + * Text of the object + */ + text: PropTypes.shape({ + /** + * Data of the text of the object + */ + data: PropTypes.string, + }), + }).isRequired, +}; + +export default HomePageInverseView; diff --git a/src/components/theme/Homepage/HomePageView.jsx b/src/components/theme/Homepage/HomePageView.jsx new file mode 100644 index 00000000..95a847c8 --- /dev/null +++ b/src/components/theme/Homepage/HomePageView.jsx @@ -0,0 +1,60 @@ +/** + * Document view component. + * @module components/theme/View/HomePageView + */ + +import React from 'react'; +import PropTypes from 'prop-types'; + +import { DefaultView } from '@plone/volto/components/'; + +import { BodyClass } from '@plone/volto/helpers'; + +import { hasBlocksData } from '@plone/volto/helpers'; + +/** + * Component to display the default view. + * @function HomePageView + * @param {Object} content Content object. + * @returns {string} Markup of the component. + */ +const HomePageView = ({ content }) => { + return hasBlocksData(content) ? ( + <> + + + + ) : null; +}; + +/** + * Property types. + * @property {Object} propTypes Property types. + * @static + */ +HomePageView.propTypes = { + /** + * Content of the object + */ + content: PropTypes.shape({ + /** + * Title of the object + */ + title: PropTypes.string, + /** + * Description of the object + */ + description: PropTypes.string, + /** + * Text of the object + */ + text: PropTypes.shape({ + /** + * Data of the text of the object + */ + data: PropTypes.string, + }), + }).isRequired, +}; + +export default HomePageView; diff --git a/src/customizations/volto/components/theme/Header/Header.jsx b/src/customizations/volto/components/theme/Header/Header.jsx index eabe3ee3..761641e4 100644 --- a/src/customizations/volto/components/theme/Header/Header.jsx +++ b/src/customizations/volto/components/theme/Header/Header.jsx @@ -18,10 +18,10 @@ import { getNavigation } from '@plone/volto/actions'; import { Header, Logo } from '@eeacms/volto-eea-design-system/ui'; import { usePrevious } from '@eeacms/volto-eea-design-system/helpers'; import { find } from 'lodash'; +import WhiteLogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea.svg'; import LogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea-logo.svg'; import globeIcon from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/global-line.svg'; import eeaFlag from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Header/eea.png'; -import { BodyClass } from '@plone/volto/helpers'; import config from '@plone/volto/registry'; import { compose } from 'recompose'; @@ -34,8 +34,8 @@ const EEAHeader = ({ pathname, token, items, history }) => { const translations = useSelector( (state) => state.content.data?.['@components']?.translations?.items, ); - const isHomePage = useSelector((state) => { - return state.content?.data?.['@type'] === 'Plone Site'; + const isHomePageInverse = useSelector((state) => { + return state.content?.data?.layout === 'homepage_inverse_view'; }); const { eea } = config.settings; @@ -66,7 +66,6 @@ const EEAHeader = ({ pathname, token, items, history }) => { return (
- {isHomePage && } eea flag @@ -159,9 +158,11 @@ const EEAHeader = ({ pathname, token, items, history }) => { { config.settings.eea = { ...eea, ...(config.settings.eea || {}), }; + config.views.layoutViews = { + homepage_view: HomePageView, + homepage_inverse_view: HomePageInverseView, + }; // Apply accordion block customization if (config.blocks.blocksConfig.accordion) {