diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-chromium-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-chromium-linux.png index e0e438350..504e22f67 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-chromium-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-chromium-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-webkit-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-webkit-linux.png index e9f6fbd41..d460f7545 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-webkit-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Default-light-webkit-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-chromium-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-chromium-linux.png index 207a479e9..8c618cf2d 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-chromium-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-chromium-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-webkit-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-webkit-linux.png index 2e28ffa62..a8b8d1fa7 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-webkit-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-HeaderColSize-light-webkit-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-chromium-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-chromium-linux.png index 04169bed0..2618fef22 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-chromium-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-chromium-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-webkit-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-webkit-linux.png index a29063075..d89504110 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-webkit-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-Size-light-webkit-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-chromium-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-chromium-linux.png index 0e0e95450..f949fe058 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-chromium-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-chromium-linux.png differ diff --git a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-webkit-linux.png b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-webkit-linux.png index 7766d0d63..8d2c297b0 100644 Binary files a/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-webkit-linux.png and b/src/blocks/Icons/__snapshots__/Icons.visual.test.tsx-snapshots/Icons-render-stories-WithText-light-webkit-linux.png differ diff --git a/src/blocks/Icons/__stories__/Icons.stories.tsx b/src/blocks/Icons/__stories__/Icons.stories.tsx index bf415f9f2..12c379db5 100644 --- a/src/blocks/Icons/__stories__/Icons.stories.tsx +++ b/src/blocks/Icons/__stories__/Icons.stories.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import {Meta, StoryFn} from '@storybook/react'; -import {yfmTransform} from '../../../../.storybook/utils'; -import {PageConstructor} from '../../../containers/PageConstructor/PageConstructor'; +import {IconsBlock} from '../..'; +import {blockTransform} from '../../../../.storybook/utils'; import {IconsBlockModel, IconsBlockProps} from '../../../models'; import Icons from '../Icons'; @@ -15,60 +15,91 @@ export default { } as Meta; const DefaultTemplate: StoryFn = (args) => ( - +
+ +
); -const WithDescriptionTemplate: StoryFn = (args) => ( - -); - -const SizeTemplate: StoryFn = (args) => ( +const SizeTemplate: StoryFn> = (args) => ( - - - + {Object.entries(args) + .map(([key, item]) => { + const transformed = blockTransform(item) as IconsBlockProps; + return ( +
+ +
+ ); + }) + .filter(Boolean)}
); -const ColSizeTemplate: StoryFn = (args) => ( - - - +const ColSizeTemplate: StoryFn> = (args) => ( +
+ {Object.entries(args) + .map(([key, item]) => { + const transformed = blockTransform(item) as IconsBlockProps; + return ; + }) + .filter(Boolean)} +
); -export const Default = DefaultTemplate.bind([]); -export const Size = SizeTemplate.bind([]); -export const WithText = WithDescriptionTemplate.bind({}); +export const Default = DefaultTemplate.bind({}); +export const Size = SizeTemplate.bind({}); +export const WithText = DefaultTemplate.bind({}); export const HeaderColSize = ColSizeTemplate.bind({}); -const transformedText = yfmTransform(data.withDescription.content.description); +Default.args = data.default.content as IconsBlockModel; + +WithText.args = data.withDescription.content as IconsBlockModel; + +const SIZES: Record = { + size_s: { + ...data.size.content, + title: 'Size S', + size: 's', + } as IconsBlockModel, + size_m: { + ...data.size.content, + title: 'Size M', + size: 'm', + } as IconsBlockModel, + size_l: { + ...data.size.content, + title: 'Size L', + size: 'l', + } as IconsBlockModel, +}; + +Size.args = SIZES; +Size.parameters = { + controls: { + include: Object.keys(SIZES), + }, +}; + +const COL_SIZES: Record = { + col_12: { + ...data.withDescription.content, + title: 'ColSize 12', + } as IconsBlockModel, + col_8: { + ...data.withDescription.content, + title: 'ColSize 8', + colSizes: {all: 8}, + } as IconsBlockModel, + col_4: { + ...data.withDescription.content, + title: 'ColSize 4', + colSizes: {all: 4}, + } as IconsBlockModel, +}; -Default.args = data.default.content as IconsBlockProps; -Size.args = data.size.content as Omit; -WithText.args = { - ...data.withDescription.content, - description: transformedText, -} as IconsBlockProps; -HeaderColSize.args = { - ...data.withDescription.content, - description: transformedText, -} as IconsBlockProps; +HeaderColSize.args = COL_SIZES; +HeaderColSize.parameters = { + controls: { + include: Object.keys(COL_SIZES), + }, +};