Skip to content

Commit

Permalink
Merge pull request #84 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ionlizarazu authored Sep 24, 2021
2 parents 7ee1753 + eca2a61 commit 69fb02d
Show file tree
Hide file tree
Showing 19 changed files with 316 additions and 50 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,27 @@ 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).

#### [1.0.26](https://github.com/eea/volto-clms-theme/compare/1.0.25...1.0.26)

- Home carousel [`#83`](https://github.com/eea/volto-clms-theme/pull/83)
- volto-tabs-block style reverted [`#82`](https://github.com/eea/volto-clms-theme/pull/82)
- accordion icons customization [`6a81d74`](https://github.com/eea/volto-clms-theme/commit/6a81d74736ea8b1cbe41a04bc38010a29761eaf5)
- upgrade volto-accordion-block version [`e574eb5`](https://github.com/eea/volto-clms-theme/commit/e574eb5fb2bca7a3dfdef043219159a0e35e84f9)
- home carousel css fix [`e81873c`](https://github.com/eea/volto-clms-theme/commit/e81873c25cfabe48cfc306aa42488a6d792ecc2b)
- carousel [`a8bb18b`](https://github.com/eea/volto-clms-theme/commit/a8bb18bb3a22401906b141bd20a3f2673c70a809)
- sitemap.js customization [`2227584`](https://github.com/eea/volto-clms-theme/commit/2227584d64618d81fe32ad8e7cb4774b367ab6c7)
- carousel [`372b59c`](https://github.com/eea/volto-clms-theme/commit/372b59c8ae834742ae57c5893680cea876ebb9be)
- less [`c0df2ce`](https://github.com/eea/volto-clms-theme/commit/c0df2cebb0dc124c4bcb9a7e8e6b810035f1ff2a)
- volto-tabs-block style reversed [`5fd228e`](https://github.com/eea/volto-clms-theme/commit/5fd228e1c432f7089ae477561dff09bb5f0ec420)
- home page carrousel left [`493b2e5`](https://github.com/eea/volto-clms-theme/commit/493b2e5b16fcd8f1677ca57cb70660f275599b54)
- use getBaseUrl instead of replacing download-by-area [`c39c213`](https://github.com/eea/volto-clms-theme/commit/c39c2132a1e4e7c992339bcc1ba21d130daad4f9)
- logo url fix [`f1abebb`](https://github.com/eea/volto-clms-theme/commit/f1abebbc433c37e580cce49b9a855b501b1e9cf3)

#### [1.0.25](https://github.com/eea/volto-clms-theme/compare/1.0.24...1.0.25)

> 17 September 2021
- Some small code fixes [`#81`](https://github.com/eea/volto-clms-theme/pull/81)
- Fixing feedback problems [`#80`](https://github.com/eea/volto-clms-theme/pull/80)
- empty libraries message [`134ee68`](https://github.com/eea/volto-clms-theme/commit/134ee687a1de7d31d4a62795324a9738e874e605)
- class to className [`e3bccef`](https://github.com/eea/volto-clms-theme/commit/e3bccefc307424e6508dd4280bb001b45313e8d4)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-clms-theme",
"version": "1.0.25",
"version": "1.0.26",
"description": "volto-clms-theme: Volto theme for CLMS site",
"main": "src/index.js",
"author": "CodeSyntax for the European Environment Agency",
Expand Down Expand Up @@ -37,7 +37,7 @@
"@eeacms/volto-tabs-block": "1.2.7",
"react-slick": "0.28.1",
"slick-carousel": "1.8.1",
"@eeacms/volto-accordion-block": "^3.0.0",
"@eeacms/volto-accordion-block": "3.4.4",
"@eeacms/volto-columns-block": "4.4.3",
"@eeacms/volto-metadata-block": "^2.1.0",
"volto-slate": "2.6.2",
Expand Down Expand Up @@ -112,4 +112,4 @@
"@cypress/code-coverage": "^3.9.5",
"babel-plugin-transform-class-properties": "^6.24.1"
}
}
}
77 changes: 45 additions & 32 deletions src/components/Blocks/CclHomeBgImageBlock/CclGreenBgView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,51 @@ const CclGreenBgView = (props) => {
const { data, isEditMode } = props;

return (
<div
className="ccl-banner-top-container"
style={{
backgroundImage: `url(${data?.image?.url}/@@images/image)`,
}}
>
{isEditMode && <CclHomeImageEditor {...props} />}
<div className="ccl-container">
<div className="ccl-banner-top-main-block-title">
{data.title && <h1>{data?.title}</h1>}
{data.subtitle && <h2>{data?.subtitle}</h2>}
{data.description && <h3>{data?.description} </h3>}
{data?.hasButton === true && (
<CclButton
url={
data?.download && data?.href?.[0]?.['@type'] === 'File'
? data?.href?.[0]?.['@id'] + '/@@download/file'
: data?.href?.[0]?.['@id']
}
disabled={data?.disabled}
download={data?.download || data?.href?.[0]?.['@type'] === 'File'}
target={
data?.target ||
(data?.download &&
data?.href[0]['@type'] === 'File' &&
'_blank')
}
mode={data?.style}
>
{data?.buttonTitle}
</CclButton>
)}
<div className="ccl-banner-top-container">
<div
className="ccl-banner-top-main"
style={{
backgroundImage: `url(${data?.image?.url}/@@images/image)`,
}}
>
{isEditMode && <CclHomeImageEditor {...props} />}
<div className="ccl-container">
<div className="ccl-banner-top-main-block-title">
{data.title && <h1>{data?.title}</h1>}
{data.subtitle && <h2>{data?.subtitle}</h2>}
{data.description && <h3>{data?.description} </h3>}
{data?.hasButton === true && (
<CclButton
url={
data?.download && data?.href?.[0]?.['@type'] === 'File'
? data?.href?.[0]?.['@id'] + '/@@download/file'
: data?.href?.[0]?.['@id']
}
disabled={data?.disabled}
download={
data?.download || data?.href?.[0]?.['@type'] === 'File'
}
target={
data?.target ||
(data?.download &&
data?.href[0]['@type'] === 'File' &&
'_blank')
}
mode={data?.style}
>
{data?.buttonTitle}
</CclButton>
)}
</div>
</div>
</div>
<div class="ccl-banner-top-bar">
<div class="ccl-container">
<div class="ccl-banner-top-bar-left">{data?.greenText}</div>
<div class="ccl-banner-top-bar-right">
<span class="ccl-icon-map-dot"></span>
{data?.location}
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ export const HomeBgImageSchema = (config, hasButton) => {
{
id: 'default',
title: 'Default',
fields: ['title', 'subtitle', 'description', 'variation', 'hasButton'],
fields: [
'title',
'subtitle',
'description',
'variation',
'greenText',
'location',
'hasButton',
],
},
...hasButtonFieldset,
],
Expand Down Expand Up @@ -49,6 +57,16 @@ export const HomeBgImageSchema = (config, hasButton) => {
type: 'array',
choices: [...variations],
},
greenText: {
title: 'Left text',
description: 'Green bg left side text',
type: 'string',
},
location: {
title: 'Location',
description: 'Green bg location',
type: 'string',
},
buttonTitle: {
title: 'Title',
description: 'Add button text',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import { withRouter } from 'react-router';
import loadable from '@loadable/component';
import { RenderBlocks } from '@plone/volto/components';
import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
import './custom.less';

const Slider = loadable(() => import('react-slick'));

const View = (props) => {
const slider = React.useRef(null);
const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
const {
activeTab = null,
data = {},
hashlink = {},
metadata = {},
tabsList = [],
tabs = {},
setActiveTab = () => {},
} = props;
const activeTabIndex = tabsList.indexOf(activeTab);

const settings = {
dots: true,
infinite: true,
speed: 1500,
fade: true,
cssEase: 'linear',
autoplay: true,
autoplaySpeed: 3000,
swipe: true,
slidesToShow: 1,
slidesToScroll: 1,
touchMove: true,
beforeChange: (oldIndex, index) => {
setActiveTab(tabsList[index]);
},
};

React.useEffect(() => {
const urlHash = props.location.hash.substring(1) || '';
if (
hashlink.counter > 0 ||
(hashlink.counter === 0 && urlHash && !hashlinkOnMount)
) {
const id = hashlink.hash || urlHash || '';
const index = tabsList.indexOf(id);
const parentId = data.id || props.id;
const parent = document.getElementById(parentId);
// TODO: Find the best way to add offset relative to header
// The header can be static on mobile and relative on > mobile
// const headerWrapper = document.querySelector('.header-wrapper');
// const offsetHeight = headerWrapper?.offsetHeight || 0;
const offsetHeight = 0;
if (id !== parentId && index > -1 && parent) {
if (activeTabIndex !== index) {
slider.current.slickGoTo(index);
}
props.scrollToTarget(parent, offsetHeight);
} else if (id === parentId && parent) {
props.scrollToTarget(parent, offsetHeight);
}
}
if (!hashlinkOnMount) {
setHashlinkOnMount(true);
}
/* eslint-disable-next-line */
}, [hashlink.counter]);

const panes = tabsList.map((tab, index) => {
return {
id: tab,
renderItem: (
<RenderBlocks
key={`slide-${tab}`}
{...props}
metadata={metadata}
content={tabs[tab]}
/>
),
};
});

return (
<>
<Slider {...settings} ref={slider} className="home-carousel">
{panes.length ? panes.map((pane) => pane.renderItem) : ''}
</Slider>
</>
);
};

export default compose(
connect((state) => {
return {
hashlink: state.hashlink,
};
}),
withScrollToTarget,
)(withRouter(View));
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const CclTabsView = (props) => {
aria-controls={title || defaultTitle}
aria-selected={tab === activeTab}
active={(tab === activeTab).toString()}
/* classname hontan estiloa aldatu behar da aukeratutako tab-a urdin ikusteko */
className={cx('tab', tab !== activeTab && 'tab-selected')}
/* classname hontan estiloa aldatu behar bada "===" "!==" gatik aldatu */
className={cx('tab', tab === activeTab && 'tab-selected')}
onClick={() => {
if (activeTab !== tab) {
setActiveTab(tab);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { RenderBlocks } from '@plone/volto/components';
import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';
import './fontawesome';
import cx from 'classnames';
import './custom.less';

const CclVerticalFaqTabsView = (props) => {
const [hashlinkOnMount, setHashlinkOnMount] = React.useState(false);
Expand Down
15 changes: 15 additions & 0 deletions src/components/Blocks/CustomTemplates/VoltoTabsBlock/custom.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.tabs-block.CCLVerticalFaqTabs > div.styled {
display: block !important;
}

div.tabs-block.CCLCarousel {
div & {
position: relative !important;
right: 50% !important;
left: 50% !important;
width: 100vw !important;
max-width: initial !important;
margin-right: -50vw !important;
margin-left: -50vw !important;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import CclTabsView from './CclTabsView';
import CclVerticalTabsView from './CclVerticalTabsView';
import CclVerticalFaqTabsView from './CclVerticalFaqTabsView';
import CclCarouselView from './CclCarouselView';

export { CclTabsView, CclVerticalTabsView, CclVerticalFaqTabsView };
export {
CclTabsView,
CclVerticalTabsView,
CclVerticalFaqTabsView,
CclCarouselView,
};
17 changes: 17 additions & 0 deletions src/components/Blocks/customBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
CclTabsView,
CclVerticalTabsView,
CclVerticalFaqTabsView,
CclCarouselView,
} from '@eeacms/volto-clms-theme/components/Blocks/CustomTemplates/VoltoTabsBlock';

import {
Expand Down Expand Up @@ -61,6 +62,9 @@ import CclUseCaseListEdit from '@eeacms/volto-clms-theme/components/Blocks/CclUs
import CclTechnicalLibrariesListView from '@eeacms/volto-clms-theme/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListView';
import CclTechnicalLibrariesListEdit from '@eeacms/volto-clms-theme/components/Blocks/CclTechnicalLibrariesList/CclTechnicalLibrariesListEdit';

import upSVG from '@plone/volto/icons/up-key.svg';
import downSVG from '@plone/volto/icons/down-key.svg';

export const customGroupBlocksOrder = {
id: 'ccl_blocks',
title: 'Ccl Blocks',
Expand Down Expand Up @@ -106,6 +110,12 @@ const customBlocks = (config) => ({
view: CclVerticalFaqTabsView,
schema: defaultSchema,
},
CCLCarousel: {
title: 'CCL Carousel (Copernicus Style Guide)',
edit: DefaultEdit,
view: CclCarouselView,
schema: defaultSchema,
},
...(config.blocks.blocksConfig[TABS_BLOCK]?.templates || {}),
},
},
Expand Down Expand Up @@ -164,6 +174,13 @@ const customBlocks = (config) => ({
},
],
},
accordion: {
...config.blocks.blocksConfig.accordion,
titleIcons: {
closed: { leftPosition: downSVG, rightPosition: downSVG },
opened: { leftPosition: upSVG, rightPosition: upSVG },
},
},
contextNavigation: {
id: 'contextNavigation', // The name (id) of the block
title: 'Context Navigation', // The display name of the block
Expand Down
17 changes: 16 additions & 1 deletion src/components/CLMSEventView/CLMSEventView.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
import { StringToHTML } from '@eeacms/volto-clms-theme/components/CclUtils';

export const CLMSEventView = (props) => {
Expand All @@ -19,11 +20,25 @@ export const CLMSEventView = (props) => {
}
alt={content?.image ? content?.image?.filename : 'Placeholder'}
/>
{/* <figcaption>Lorem ipsum dolor sit amet</figcaption> */}
<figcaption>{content?.description}</figcaption>
</figure>
<div class="event-detail-when">
<i class="far fa-calendar-alt"></i>
<div class="event-detail-when-text">
{new Date(content?.effective).toLocaleDateString()} -{' '}
{new Date(content?.end).toLocaleDateString()}
</div>
</div>
<div class="event-detail-where">
<i class="fas fa-map-marker-alt"></i>
<div class="event-detail-where-text">{content?.location}</div>
</div>
<div className="event-detail-content">
<StringToHTML string={content.text?.data || ''} />
</div>
<CclButton url="#" disabled={false}>
{'Register here'}
</CclButton>
</div>
</div>
);
Expand Down
Loading

0 comments on commit 69fb02d

Please sign in to comment.