From c27007146a7e65911c7bade36f29128c3659323f Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Thu, 24 Nov 2022 21:23:57 +0200
Subject: [PATCH 01/10] upgrade to Volto 16.1.0
---
src/blocks/Listing/schema.js | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/blocks/Listing/schema.js b/src/blocks/Listing/schema.js
index 74d66f69..16468f6a 100644
--- a/src/blocks/Listing/schema.js
+++ b/src/blocks/Listing/schema.js
@@ -234,10 +234,15 @@ export const setCardStylingSchema = ({ schema, intl }) => {
const itemModelSchema = schema.properties.itemModel;
const styleSchema = itemModelSchema.schema.properties.styles.schema;
const fieldset = styleSchema.fieldsets.find(({ id }) => id === 'default');
- fieldset.fields.push('theme', 'inverted', 'rounded', 'text');
+ fieldset.fields.push(
+ 'theme:noprefix',
+ 'inverted:bool',
+ 'rounded:bool',
+ 'text:noprefix',
+ );
styleSchema.properties = {
...styleSchema.properties,
- theme: {
+ 'theme:noprefix': {
title: intl.formatMessage(messages.Theme),
description: intl.formatMessage(messages.ThemeHelp),
choices: [
@@ -247,17 +252,17 @@ export const setCardStylingSchema = ({ schema, intl }) => {
['tertiary', intl.formatMessage(messages.ThemeTertiary)],
],
},
- inverted: {
+ 'inverted:bool': {
title: intl.formatMessage(messages.Inverted),
description: intl.formatMessage(messages.InvertedHelp),
type: 'boolean',
},
- rounded: {
+ 'rounded:bool': {
title: intl.formatMessage(messages.Rounded),
description: intl.formatMessage(messages.RoundedHelp),
type: 'boolean',
},
- text: {
+ 'text:noprefix': {
title: 'Text align',
widget: 'style_text_align',
actions: Object.keys(ALIGN_INFO_MAP),
From e2cde0897ea46aefbf599f175d487f72f29f12b0 Mon Sep 17 00:00:00 2001
From: Alin Voinea
Date: Fri, 25 Nov 2022 15:07:38 +0200
Subject: [PATCH 02/10] yarn 3
---
package.json | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 81be827f..f927001b 100644
--- a/package.json
+++ b/package.json
@@ -18,13 +18,13 @@
},
"addons": [],
"dependencies": {
+ "react-resize-detector": "7.1.2",
"react-slick": "0.29.0",
- "slick-carousel": "1.8.1",
- "react-resize-detector": "7.1.2"
+ "slick-carousel": "1.8.1"
},
"devDependencies": {
- "@plone/scripts": "*",
"@cypress/code-coverage": "^3.10.0",
+ "@plone/scripts": "*",
"babel-plugin-transform-class-properties": "^6.24.1",
"md5": "^2.3.0"
},
From d5e46cd596e170bc01d20e2f273eec65f4093813 Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Mon, 28 Nov 2022 16:57:55 +0200
Subject: [PATCH 03/10] fix(buttons): check for styles from item styling
instead of block styles
- now that the classes are set on the items we need to check from the item model for any theme or inverted option
---
src/components/UniversalCard/fragments/CardExtra.jsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/UniversalCard/fragments/CardExtra.jsx b/src/components/UniversalCard/fragments/CardExtra.jsx
index b2001827..2314fe48 100644
--- a/src/components/UniversalCard/fragments/CardExtra.jsx
+++ b/src/components/UniversalCard/fragments/CardExtra.jsx
@@ -16,9 +16,9 @@ const CallToAction = ({ item, itemModel, styles }) => (
as="a"
href={getCallToAction(item, itemModel.callToAction)}
className={
- styles?.theme
- ? styles.inverted
- ? styles.theme + ' inverted'
+ itemModel?.styles['theme:noprefix']
+ ? itemModel?.styles['inverted:bool']
+ ? itemModel?.styles['theme:noprefix'] + ' inverted'
: 'inverted'
: 'tertiary inverted'
}
From dc7834662d77c760c6f4e7eb721caed2baa27d1a Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Mon, 28 Nov 2022 17:48:25 +0200
Subject: [PATCH 04/10] fix(labels): wrap labels within a parent div
- this way we avoid the read more button from being affected by
the flex rules and the button remains to the right side of the
extra section
---
src/components/UniversalCard/fragments/CardExtra.jsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/components/UniversalCard/fragments/CardExtra.jsx b/src/components/UniversalCard/fragments/CardExtra.jsx
index 2314fe48..e2969e7b 100644
--- a/src/components/UniversalCard/fragments/CardExtra.jsx
+++ b/src/components/UniversalCard/fragments/CardExtra.jsx
@@ -40,7 +40,11 @@ const CardExtra = ({ item, itemModel = {}, ...rest }) => {
return show ? (
- {showTags && }
+ {showTags && (
+
+
+
+ )}
{showCallToAction && (
)}
From 7102ea22cbc3e55de0181bd2d34af1a0d3d17b80 Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Mon, 28 Nov 2022 20:24:49 +0200
Subject: [PATCH 05/10] change(listing): removed override of volto-block-style
- now that we only have the container width we can avoid not adding
any styles from volto-block-style within volto-listing-block
---
src/blocks/Listing/index.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/blocks/Listing/index.js b/src/blocks/Listing/index.js
index 9512ab6d..2433feba 100644
--- a/src/blocks/Listing/index.js
+++ b/src/blocks/Listing/index.js
@@ -28,9 +28,6 @@ const applyConfig = (config) => {
const { listing } = config.blocks.blocksConfig;
const blacklist = ['summary'];
- // integration with volto-block-style
- if (config.settings.integratesBlockStyles)
- config.settings.integratesBlockStyles.push('listing');
listing.schemaEnhancer = composeSchema(
moveQueryToFieldset,
From 00c7999c6c590603cdfd069d85fc87feb95f6fea Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Tue, 29 Nov 2022 16:00:57 +0200
Subject: [PATCH 06/10] change(label): color selection for archived now is
applied when isExpired is set
- we don't have review_state == 'archived' yet
---
src/components/UniversalCard/fragments/CardImage.jsx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/components/UniversalCard/fragments/CardImage.jsx b/src/components/UniversalCard/fragments/CardImage.jsx
index 7698e6d5..0f47c255 100644
--- a/src/components/UniversalCard/fragments/CardImage.jsx
+++ b/src/components/UniversalCard/fragments/CardImage.jsx
@@ -4,7 +4,6 @@ import { ConditionalLink } from '@plone/volto/components';
import PreviewImage from '@eeacms/volto-listing-block/PreviewImage';
const getLabel = (props) => {
- // { text: 'new', side: 'left', color: 'green' }
const { item, itemModel = {} } = props;
const text = item.isNew ? 'New' : item.isExpired ? 'Archived' : null;
@@ -13,7 +12,7 @@ const getLabel = (props) => {
text,
side: 'left',
// TODO: set the colors from css?
- color: item.review_state === 'archived' ? 'yellow' : 'green',
+ color: item.isExpired ? 'yellow' : 'green',
}
: null;
};
From 45fc3c101e04903f673e37803184b4acd328b0cf Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Tue, 29 Nov 2022 19:44:54 +0200
Subject: [PATCH 07/10] change(item): date format to that of card data style
---
src/blocks/Listing/item-templates/ItemTemplates.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/blocks/Listing/item-templates/ItemTemplates.jsx b/src/blocks/Listing/item-templates/ItemTemplates.jsx
index b1b31f3e..3935b949 100644
--- a/src/blocks/Listing/item-templates/ItemTemplates.jsx
+++ b/src/blocks/Listing/item-templates/ItemTemplates.jsx
@@ -1,6 +1,5 @@
import cx from 'classnames';
import { ConditionalLink, FormattedDate } from '@plone/volto/components';
-// import { buildStyleClassNamesFromData } from '@plone/volto/helpers';
import { getVoltoStyles } from '@eeacms/volto-listing-block/schema-utils';
@@ -29,8 +28,9 @@ const BodyText = ({ item, hasDate, hasDescription }) => {
format={{
year: 'numeric',
month: 'short',
- day: 'numeric',
+ day: '2-digit',
}}
+ locale={'en-gb'}
/>
)}
From 33bb7ede253153352fa5ddc3e7fde928102158d2 Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Tue, 29 Nov 2022 19:51:42 +0200
Subject: [PATCH 08/10] change(item): listing classes to resemble the card
classes
- instead of using the default has class from the style scheme we use the
noprefix for classes that we want plain without the has prefix
- use text with has prefix since we have has--text-left or has--text-center classes defined
in volto-eea-design-system
- small code cleanup in commented schema implementation of Listing schema
---
src/blocks/Listing/schema.js | 10 +++-------
src/less/listing-cards.less | 18 +++++++-----------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/blocks/Listing/schema.js b/src/blocks/Listing/schema.js
index 16468f6a..3809ec2f 100644
--- a/src/blocks/Listing/schema.js
+++ b/src/blocks/Listing/schema.js
@@ -59,7 +59,7 @@ const CallToActionSchema = ({ formData }) => {
formData?.['@type'] === 'listing' ? 'urlTemplate' : 'href',
]
: []),
- ], //
+ ],
title: 'Default',
},
],
@@ -93,8 +93,6 @@ const CallToActionSchema = ({ formData }) => {
export const setCardModelSchema = (args) => {
const { formData, schema } = args;
- // console.log('setCardModelSchema', args);
-
const itemModelSchema = schema.properties.itemModel.schema;
itemModelSchema.fieldsets[0].fields = [
...itemModelSchema.fieldsets[0].fields,
@@ -159,8 +157,6 @@ export const setItemModelSchema = (args) => {
const { formData, schema } = args;
const itemModelSchema = schema.properties.itemModel.schema;
- // console.log('setItemModelSchema', args);
-
itemModelSchema.fieldsets[0].fields = [
...itemModelSchema.fieldsets[0].fields,
'maxTitle',
@@ -238,7 +234,7 @@ export const setCardStylingSchema = ({ schema, intl }) => {
'theme:noprefix',
'inverted:bool',
'rounded:bool',
- 'text:noprefix',
+ 'text',
);
styleSchema.properties = {
...styleSchema.properties,
@@ -262,7 +258,7 @@ export const setCardStylingSchema = ({ schema, intl }) => {
description: intl.formatMessage(messages.RoundedHelp),
type: 'boolean',
},
- 'text:noprefix': {
+ text: {
title: 'Text align',
widget: 'style_text_align',
actions: Object.keys(ALIGN_INFO_MAP),
diff --git a/src/less/listing-cards.less b/src/less/listing-cards.less
index e98ddef9..72b4ba88 100644
--- a/src/less/listing-cards.less
+++ b/src/less/listing-cards.less
@@ -107,7 +107,7 @@ each(range(5), {
}
// listing theme styling alongside inverse options
-.listing-item:not(.has--rounded--true) {
+.listing-item:not(.rounded) {
--image-max-width: 350px;
--image-max-height: 210px;
}
@@ -124,33 +124,29 @@ each(range(5), {
height: var(--image-max-height, auto);
}
-.has--rounded--true[class*='listing'] {
+.listing-item.rounded {
--image-width: 176px !important;
--image-height: 176px !important;
--border-radius: 50%;
}
-.has--theme--primary[class*='listing'] {
+.listing-item.primary {
--text-color: var(--text-color--primary, #fff);
--bg-color: var(--background-color, @primaryColor);
}
-.has--theme--secondary[class*='listing'] {
+.listing-item.secondary {
--text-color: var(--text-color--secondary, #fff);
--bg-color: var(--background-color, @secondaryColor);
}
-.has--theme--tertiary[class*='listing'] {
+.listing-item.tertiary {
--text-color: var(--text-color--tertiary, #fff);
--bg-color: var(--background-color, @tertiaryColor);
}
-.has--inverted--:not(.has--theme--)[class*='listing'] {
- --text-color: #fff;
- --theme-padding: 32px 1.5rem;
-}
-.has--inverted--true[class*='listing'] {
+.listing-item.inverted {
--text-color--primary: @primaryColor;
--text-color--secondary: @secondaryColor;
--text-color--tertiary: @tertiaryColor;
@@ -167,7 +163,7 @@ each(range(5), {
flex: 1;
}
-.listing-item:not(.has--rounded--true) {
+.listing-item:not(.rounded) {
.listing-body {
flex: 1;
}
From 40cdf1db7f7fae39a2d7bb1a16e31e3279b18846 Mon Sep 17 00:00:00 2001
From: David Ichim
Date: Tue, 29 Nov 2022 19:59:17 +0200
Subject: [PATCH 09/10] prettier fix and bump package version before release
---
package.json | 2 +-
src/less/listing-cards.less | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/package.json b/package.json
index f927001b..aceb59fc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-listing-block",
- "version": "2.1.0",
+ "version": "2.2.0",
"description": "@eeacms/volto-listing-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
diff --git a/src/less/listing-cards.less b/src/less/listing-cards.less
index 72b4ba88..3c1882e1 100644
--- a/src/less/listing-cards.less
+++ b/src/less/listing-cards.less
@@ -145,7 +145,6 @@ each(range(5), {
--bg-color: var(--background-color, @tertiaryColor);
}
-
.listing-item.inverted {
--text-color--primary: @primaryColor;
--text-color--secondary: @secondaryColor;
From c74e07f50c5ca4d8f12b481a5135d7c2cc98a95d Mon Sep 17 00:00:00 2001
From: EEA Jenkins <@users.noreply.github.com>
Date: Tue, 29 Nov 2022 18:12:48 +0000
Subject: [PATCH 10/10] Automated release 2.2.0
---
CHANGELOG.md | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 277e5f4a..fa499889 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,24 @@ 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).
+### [2.2.0](https://github.com/eea/volto-listing-block/compare/2.1.0...2.2.0) - 29 November 2022
+
+#### :bug: Bug Fixes
+
+- fix(labels): wrap labels within a parent div [David Ichim - [`dc78346`](https://github.com/eea/volto-listing-block/commit/dc7834662d77c760c6f4e7eb721caed2baa27d1a)]
+- fix(buttons): check for styles from item styling instead of block styles [David Ichim - [`d5e46cd`](https://github.com/eea/volto-listing-block/commit/d5e46cd596e170bc01d20e2f273eec65f4093813)]
+
+#### :nail_care: Enhancements
+
+- change(item): listing classes to resemble the card classes [David Ichim - [`33bb7ed`](https://github.com/eea/volto-listing-block/commit/33bb7ede253153352fa5ddc3e7fde928102158d2)]
+- change(item): date format to that of card data style [David Ichim - [`45fc3c1`](https://github.com/eea/volto-listing-block/commit/45fc3c101e04903f673e37803184b4acd328b0cf)]
+- change(label): color selection for archived now is applied when isExpired is set [David Ichim - [`00c7999`](https://github.com/eea/volto-listing-block/commit/00c7999c6c590603cdfd069d85fc87feb95f6fea)]
+- change(listing): removed override of volto-block-style [David Ichim - [`7102ea2`](https://github.com/eea/volto-listing-block/commit/7102ea22cbc3e55de0181bd2d34af1a0d3d17b80)]
+
+#### :hammer_and_wrench: Others
+
+- prettier fix and bump package version before release [David Ichim - [`40cdf1d`](https://github.com/eea/volto-listing-block/commit/40cdf1db7f7fae39a2d7bb1a16e31e3279b18846)]
+- upgrade to Volto 16.1.0 [David Ichim - [`c270071`](https://github.com/eea/volto-listing-block/commit/c27007146a7e65911c7bade36f29128c3659323f)]
### [2.1.0](https://github.com/eea/volto-listing-block/compare/2.0.1...2.1.0) - 22 November 2022
#### :bug: Bug Fixes