diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-chromium-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-chromium-linux.png index 23aaa533c..96c3aa99b 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-chromium-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-chromium-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-webkit-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-webkit-linux.png index 820f993bd..7a6472428 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-webkit-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-ColSizes-light-webkit-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-chromium-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-chromium-linux.png index 4b45c0d54..a26dc1d7b 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-chromium-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-chromium-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-webkit-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-webkit-linux.png index 253fbf57f..547996ee1 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-webkit-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-Default-light-webkit-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-chromium-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-chromium-linux.png index ca4aa6202..9c9782cdc 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-chromium-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-chromium-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-webkit-linux.png b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-webkit-linux.png index a9d3a559e..682964853 100644 Binary files a/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-webkit-linux.png and b/src/blocks/ExtendedFeatures/__snapshots__/ExtendedFeatures.visual.test.tsx-snapshots/ExtendedFeatures-render-stories-WithLabel-light-webkit-linux.png differ diff --git a/src/blocks/ExtendedFeatures/__stories__/ExtendedFeatures.stories.tsx b/src/blocks/ExtendedFeatures/__stories__/ExtendedFeatures.stories.tsx index 2dc5aa18b..8fe143e66 100644 --- a/src/blocks/ExtendedFeatures/__stories__/ExtendedFeatures.stories.tsx +++ b/src/blocks/ExtendedFeatures/__stories__/ExtendedFeatures.stories.tsx @@ -1,94 +1,65 @@ import {Meta, StoryFn} from '@storybook/react'; -import {transformOptionalTitle, yfmTransform} from '../../../../.storybook/utils'; -import {PageConstructor} from '../../../containers/PageConstructor/PageConstructor'; -import { - ExtendedFeaturesBlockModel, - ExtendedFeaturesItem, - ExtendedFeaturesProps, -} from '../../../models'; -import ExtendedFeatures from '../ExtendedFeatures'; +import {blockTransform} from '../../../../.storybook/utils'; +import {ExtendedFeaturesBlockModel, ExtendedFeaturesProps} from '../../../models'; +import ExtendedFeatures, {ExtendedFeaturesBlock} from '../ExtendedFeatures'; import data from './data.json'; export default { - title: 'Blocks/ExtendedFeatures', component: ExtendedFeatures, - args: { - colSizes: { - all: 12, - sm: 6, - md: 4, - }, - }, + title: 'Blocks/ExtendedFeatures', } as Meta; -const DefaultTemplate: StoryFn = (args) => ( - -); - -const extendedFeaturesItems = (items: ExtendedFeaturesItem[]) => { - return items.map((item) => ({ - ...item, - title: transformOptionalTitle(item.title), - list: item.list?.map((listItem) => ({ - ...listItem, - title: transformOptionalTitle(listItem.title), - text: listItem?.text && yfmTransform(listItem.text), - })), - text: item.text && yfmTransform(item.text), - additionalInfo: item.additionalInfo && yfmTransform(item.additionalInfo), - })); +const DefaultTemplate: StoryFn = (args) => { + const transformed = blockTransform(args) as ExtendedFeaturesProps; + return ( +
+ +
+ ); }; -const ColSizesTemplate: StoryFn = (args) => ( - +const ColSizesTemplate: StoryFn> = (args) => ( +
+ {Object.entries(args) + .map(([key, item]) => { + const transformed = blockTransform(item) as ExtendedFeaturesProps; + return ; + }) + .filter(Boolean)} +
); export const Default = DefaultTemplate.bind({}); export const WithLabel = DefaultTemplate.bind({}); export const ColSizes = ColSizesTemplate.bind({}); -const DefaultArgs = { - ...data.default.content, - title: transformOptionalTitle(data.default.content.title), - description: yfmTransform(data.default.content.description), - items: extendedFeaturesItems(data.default.content.items as ExtendedFeaturesItem[]), -}; +Default.args = data.default.content as ExtendedFeaturesBlockModel; -Default.args = {...DefaultArgs} as ExtendedFeaturesProps; WithLabel.args = { - ...DefaultArgs, - items: extendedFeaturesItems(data.withLabel.content.items as ExtendedFeaturesItem[]), -} as ExtendedFeaturesProps; -ColSizes.args = { ...data.default.content, - items: extendedFeaturesItems(data.default.content.items as ExtendedFeaturesItem[]), -} as ExtendedFeaturesProps; + items: data.withLabel?.content?.items, +} as ExtendedFeaturesBlockModel; + +const COL_SIZES: Record = { + four_columns: { + ...data.default.content, + ...data.colSizes?.four, + } as ExtendedFeaturesBlockModel, + three_columns: { + ...data.default.content, + ...data.colSizes?.three, + } as ExtendedFeaturesBlockModel, + two_columns: { + ...data.default.content, + ...data.colSizes?.two, + } as ExtendedFeaturesBlockModel, +}; + +ColSizes.args = COL_SIZES; +ColSizes.parameters = { + controls: { + include: Object.keys(COL_SIZES), + }, +};