diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-chromium-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-chromium-linux.png index 8abb5fe25..50bd56be2 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-chromium-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-chromium-linux.png differ diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-webkit-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-webkit-linux.png index 1c57a3c19..e70241b92 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-webkit-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-Default-light-webkit-linux.png differ diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-chromium-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-chromium-linux.png index 2b384ccde..cc04a27cc 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-chromium-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-chromium-linux.png differ diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-webkit-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-webkit-linux.png index ee76a348f..a4e9a5963 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-webkit-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-LightTheme-light-webkit-linux.png differ diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-chromium-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-chromium-linux.png index ed6407261..68b093227 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-chromium-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-chromium-linux.png differ diff --git a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-webkit-linux.png b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-webkit-linux.png index 42e8356b3..10cce1f02 100644 Binary files a/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-webkit-linux.png and b/src/blocks/Info/__snapshots__/Info.visual.test.tsx-snapshots/Info-render-stories-WithContentList-light-webkit-linux.png differ diff --git a/src/blocks/Info/__stories__/Info.stories.tsx b/src/blocks/Info/__stories__/Info.stories.tsx index ca1b28c07..08ad7ea7c 100644 --- a/src/blocks/Info/__stories__/Info.stories.tsx +++ b/src/blocks/Info/__stories__/Info.stories.tsx @@ -1,74 +1,51 @@ import {Meta, StoryFn} from '@storybook/react'; -import {yfmTransform} from '../../../../.storybook/utils'; -import {PageConstructor} from '../../../containers/PageConstructor/PageConstructor'; -import {ContentItemProps, InfoBlockModel, InfoBlockProps} from '../../../models'; +import {blockTransform} from '../../../../.storybook/utils'; +import {CustomBlock, InfoBlockModel, InfoBlockProps} from '../../../models'; import Info from '../Info'; import data from './data.json'; -const transformedContentList = data.common.list.map((item) => { - return { - ...item, - text: item?.text && yfmTransform(item.text), - }; -}) as ContentItemProps[]; - export default { title: 'Blocks/Info', component: Info, } as Meta; -const DefaultTemplate: StoryFn = (args) => ( - +const DefaultTemplate: StoryFn = (args) => ( + ); export const Default = DefaultTemplate.bind({}); -export const WithContentList = DefaultTemplate.bind({}); export const LightTheme = DefaultTemplate.bind({}); +export const WithContentList = DefaultTemplate.bind({}); -const transformedText = yfmTransform(data.common.text); - -Default.args = { - ...data.dark.content, - leftContent: { - ...data.dark.content.leftContent, - title: data.common.title, - text: transformedText, - }, - rightContent: { - title: data.common.title, - links: data.common.links, - text: transformedText, - }, -} as InfoBlockProps; +Default.args = data.default as InfoBlockModel; LightTheme.args = { - ...data.light.content, - leftContent: { - ...data.light.content.leftContent, - title: data.common.title, - text: transformedText, + ...data.default, + ...data.light, +} as InfoBlockModel; +LightTheme.parameters = { + controls: { + include: Object.keys(LightTheme.args), }, - rightContent: { - title: data.common.title, - links: data.common.links, - text: transformedText, - }, -} as InfoBlockProps; +}; WithContentList.args = { - ...data.light.content, + type: data.default.type, + theme: data.light.theme, + backgroundColor: data.light.backgroundColor, leftContent: { - ...data.dark.content.leftContent, - title: data.common.title, - text: transformedText, - list: transformedContentList, + ...data.default.leftContent, + list: data.list, }, rightContent: { - title: data.common.title, - links: data.common.links, - text: transformedText, - list: transformedContentList, + ...data.default.rightContent, + list: data.list, + }, +} as InfoBlockModel; +WithContentList.parameters = { + controls: { + include: Object.keys(WithContentList.args), }, -} as InfoBlockProps; +}; diff --git a/src/blocks/Info/__stories__/data.json b/src/blocks/Info/__stories__/data.json index a9816bf4e..81ce02c1b 100644 --- a/src/blocks/Info/__stories__/data.json +++ b/src/blocks/Info/__stories__/data.json @@ -1,90 +1,89 @@ { - "common": { - "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", - "links": [ - { - "url": "#", - "text": "Link", - "theme": "normal", - "arrow": true - }, - { - "url": "#", - "text": "Link", - "theme": "normal", - "arrow": true - } - ], - "list": [ - { - "icon": { - "light": "/story-assets/icon_1_light.svg", - "dark": "/story-assets/icon_1_dark.svg" + "default": { + "type": "info-block", + "theme": "dark", + "leftContent": { + "title": "Lorem ipsum dolor sit amet", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + "buttons": [ + { + "text": "Button", + "theme": "raised", + "url": "#" }, - "title": "Lorem ipsum", - "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - }, - { - "icon": { - "light": "/story-assets/icon_3_light.svg", - "dark": "/story-assets/icon_3_dark.svg" + { + "text": "Button", + "theme": "outlined-contrast", + "url": "#" + } + ] + }, + "rightContent": { + "title": "Lorem ipsum dolor sit amet", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + "links": [ + { + "url": "#", + "text": "Link", + "theme": "normal", + "arrow": true }, - "title": "Lorem ipsum ipsum", - "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - }, - { - "icon": { - "light": "/story-assets/icon_2_light.svg", - "dark": "/story-assets/icon_2_dark.svg" - }, - "title": "Lorem ipsum", - "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - } - ], - "title": "Lorem ipsum dolor sit amet" + { + "url": "#", + "text": "Link", + "theme": "normal", + "arrow": true + } + ] + } }, "light": { - "content": { - "type": "info-block", - "theme": "light", - "backgroundColor": { - "dark": "#000", - "light": "#eef3fe" - }, - "leftContent": { - "buttons": [ - { - "text": "Button", - "theme": "action", - "url": "#" - }, - { - "text": "Button", - "theme": "outlined", - "url": "#" - } - ] - } + "theme": "light", + "backgroundColor": { + "dark": "#000", + "light": "#eef3fe" + }, + "leftContent": { + "title": "Lorem ipsum dolor sit amet", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + "buttons": [ + { + "text": "Button", + "theme": "action", + "url": "#" + }, + { + "text": "Button", + "theme": "outlined", + "url": "#" + } + ] } }, - "dark": { - "content": { - "type": "info-block", - "theme": "dark", - "leftContent": { - "buttons": [ - { - "text": "Button", - "theme": "raised", - "url": "#" - }, - { - "text": "Button", - "theme": "outlined-contrast", - "url": "#" - } - ] - } + "list": [ + { + "icon": { + "light": "/story-assets/icon_1_light.svg", + "dark": "/story-assets/icon_1_dark.svg" + }, + "title": "Lorem ipsum", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + }, + { + "icon": { + "light": "/story-assets/icon_3_light.svg", + "dark": "/story-assets/icon_3_dark.svg" + }, + "title": "Lorem ipsum ipsum", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + }, + { + "icon": { + "light": "/story-assets/icon_2_light.svg", + "dark": "/story-assets/icon_2_dark.svg" + }, + "title": "Lorem ipsum", + "text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." } - } + ] }