From d6a226fa2b68e141e3a67c65c1fa54ba8939384c Mon Sep 17 00:00:00 2001 From: Tiberiu Ichim Date: Mon, 26 Sep 2022 21:29:30 +0300 Subject: [PATCH] Plug into cards --- src/blocks/Listing/templates/CardsCarousel.jsx | 14 ++++++++++++++ src/components/UniversalCard/schema.js | 18 ++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/blocks/Listing/templates/CardsCarousel.jsx b/src/blocks/Listing/templates/CardsCarousel.jsx index f5dee25a..cc388f80 100644 --- a/src/blocks/Listing/templates/CardsCarousel.jsx +++ b/src/blocks/Listing/templates/CardsCarousel.jsx @@ -145,4 +145,18 @@ CardsCarousel.schemaEnhancer = (args) => { }; }; +CardsCarousel.styleSchemaEnhancer = ({ schema, intl }) => { + const styleSchema = schema.properties.styles.schema; + styleSchema.fieldsets[0].fields.push('oblique'); + styleSchema.properties = { + ...styleSchema.properties, + oblique: { + title: 'Oblique', + type: 'boolean', + }, + }; + + return schema; +}; + export default CardsCarousel; diff --git a/src/components/UniversalCard/schema.js b/src/components/UniversalCard/schema.js index 72c25b26..4835fd12 100644 --- a/src/components/UniversalCard/schema.js +++ b/src/components/UniversalCard/schema.js @@ -1,5 +1,8 @@ import { defineMessages } from 'react-intl'; -import { schemaEnhancerFactory } from '@eeacms/volto-listing-block/schema-utils'; +import { + schemaEnhancerFactory, + enhanceStylingSchema, +} from '@eeacms/volto-listing-block/schema-utils'; const messages = defineMessages({ title: { @@ -113,8 +116,10 @@ export default function universalCardSchemaEnhancer(props) { const enhancer = schemaEnhancerFactory({ extensionName: 'cardTemplates', messages, + blockType: 'listing', + extensionField: '@type', }); - return { + const baseSchema = { ...schema, fieldsets: [ ...schema.fieldsets, @@ -136,4 +141,13 @@ export default function universalCardSchemaEnhancer(props) { }, }, }; + + const styledSchema = enhanceStylingSchema({ + ...props, + schema: baseSchema, + // schema: baseSchema.properties.styles.schema, + formData: props.formData, + }); + + return styledSchema; }