Skip to content

Commit 48741d7

Browse files
author
Juli Ovechkina
authored
fix: filter-block transform (#702)
1 parent c689347 commit 48741d7

File tree

8 files changed

+30
-19
lines changed

8 files changed

+30
-19
lines changed

src/blocks/ExtendedFeatures/__stories__/ExtendedFeatures.stories.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default {
2222
sm: 6,
2323
md: 4,
2424
},
25-
description: undefined,
2625
},
2726
} as Meta;
2827

@@ -45,17 +44,20 @@ const ColSizesTemplate: StoryFn<ExtendedFeaturesBlockModel> = (args) => (
4544
{
4645
...args,
4746
...data.colSizes.four,
47+
description: yfmTransform(data.colSizes.four.description),
4848
items: extendedFeaturesItems(
4949
data.colSizes.four.items as ExtendedFeaturesItem[],
5050
),
5151
},
5252
{
5353
...args,
5454
...data.colSizes.three,
55+
description: yfmTransform(data.colSizes.three.description),
5556
},
5657
{
5758
...args,
5859
...data.colSizes.two,
60+
description: yfmTransform(data.colSizes.two.description),
5961
items: extendedFeaturesItems(data.colSizes.two.items as ExtendedFeaturesItem[]),
6062
},
6163
],
@@ -67,12 +69,15 @@ export const Default = DefaultTemplate.bind({});
6769
export const WithLabel = DefaultTemplate.bind({});
6870
export const ColSizes = ColSizesTemplate.bind({});
6971

70-
Default.args = {
72+
const DefaultArgs = {
7173
...data.default.content,
74+
description: yfmTransform(data.default.content.description),
7275
items: extendedFeaturesItems(data.default.content.items as ExtendedFeaturesItem[]),
73-
} as ExtendedFeaturesProps;
76+
};
77+
78+
Default.args = {...DefaultArgs} as ExtendedFeaturesProps;
7479
WithLabel.args = {
75-
...data.withLabel.content,
80+
...DefaultArgs,
7681
items: extendedFeaturesItems(data.withLabel.content.items as ExtendedFeaturesItem[]),
7782
} as ExtendedFeaturesProps;
7883
ColSizes.args = {

src/blocks/ExtendedFeatures/__stories__/data.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"content": {
44
"type": "extended-features-block",
55
"title": {
6-
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
6+
"text": "Lorem ipsum dolor sit amet",
77
"textSize": "m"
88
},
9+
"description": "Three **cards in a row on the desktop**, two cards in a row on a tablet, one card in a row on a mobile phone.",
910
"items": [
1011
{
1112
"title": "Sed do eiusmod tempor incididunt",
@@ -57,11 +58,6 @@
5758
},
5859
"withLabel": {
5960
"content": {
60-
"type": "extended-features-block",
61-
"title": {
62-
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
63-
"textSize": "m"
64-
},
6561
"items": [
6662
{
6763
"title": "Sed do eiusmod tempor",
@@ -116,7 +112,7 @@
116112
"colSizes": {
117113
"two": {
118114
"title": "Extended Features",
119-
"description": "Two features in a row on all devices",
115+
"description": "Two features **in a row** on all devices",
120116
"colSizes": {
121117
"all": 6
122118
},
@@ -157,11 +153,11 @@
157153
},
158154
"three": {
159155
"title": "Extended Features (default)",
160-
"description": "Three Features in a row on the desktop, three features in a row on a tablet, two features in a row on a mobile phone."
156+
"description": "Three Features **in a row** on the desktop, three features in a row on a tablet, two features in a row on a mobile phone."
161157
},
162158
"four": {
163159
"title": "Extended Features",
164-
"description": "Four features in a row on the desktop, three features in a row on a tablet, two features in a row on a mobile phone.",
160+
"description": "Four features **in a row** on the desktop, three features in a row on a tablet, two features in a row on a mobile phone.",
165161
"colSizes": {
166162
"all": 6,
167163
"sm": 4,

src/blocks/FilterBlock/__stories__/FilterBlock.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import {Meta, StoryFn} from '@storybook/react';
44

5+
import {yfmTransform} from '../../../../.storybook/utils';
56
import {PageConstructor} from '../../../containers/PageConstructor';
67
import {
78
FilterBlockModel,
@@ -41,7 +42,7 @@ const createArgs = (overrides: Partial<FilterBlockProps>) =>
4142
({
4243
type: 'filter-block',
4344
title: data.default.content.title,
44-
description: data.default.content.description,
45+
description: yfmTransform(data.default.content.description),
4546
tags: data.default.filters,
4647
items: createItemList(6, data.default.card, data.default.filters),
4748
...overrides,

src/blocks/FilterBlock/__stories__/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"content": {
1414
"type": "card-layout-block",
1515
"title": "Card Layout",
16-
"description": "Three cards in a row on the desktop, two cards in a row on a tablet, one card in a row on a mobile phone."
16+
"description": "Three **cards in a row on the desktop**, two cards in a row on a tablet, one card in a row on a mobile phone."
1717
},
1818
"filters": [
1919
{

src/blocks/Form/__stories__/Form.stories.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react';
33
import {Meta, StoryFn} from '@storybook/react';
44
import {v4 as uuidv4} from 'uuid';
55

6+
import {yfmTransform} from '../../../../.storybook/utils';
67
import {PageConstructor} from '../../../containers/PageConstructor';
78
import {FormBlockDirection, FormBlockModel, isHubspotDataForm} from '../../../models';
89
import FormBlock from '../Form';
@@ -12,7 +13,13 @@ import data from './data.json';
1213
export default {
1314
title: 'Blocks/Form',
1415
component: FormBlock,
15-
args: data.default,
16+
args: {
17+
...data.default,
18+
textContent: {
19+
...data.default.textContent,
20+
text: yfmTransform(data.default.textContent.text),
21+
},
22+
},
1623
argTypes: {
1724
type: {control: false},
1825
direction: {options: FormBlockDirection, control: {type: 'select'}},

src/blocks/Icons/__stories__/Icons.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ const SizeTemplate: StoryFn<IconsBlockModel> = (args) => (
3232

3333
export const Default = DefaultTemplate.bind([]);
3434
export const Size = SizeTemplate.bind([]);
35-
export const WithDescription = WithDescriptionTemplate.bind({});
35+
export const WithText = WithDescriptionTemplate.bind({});
3636

3737
const transformedText = yfmTransform(data.withDescription.content.description);
3838

3939
Default.args = data.default.content as IconsBlockProps;
4040
Size.args = data.size.content as Omit<IconsBlockProps, 'size'>;
41-
WithDescription.args = {
41+
WithText.args = {
4242
...data.withDescription.content,
4343
description: transformedText,
4444
} as IconsBlockProps;

src/blocks/Icons/__stories__/data.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
"withDescription": {
6666
"content": {
6767
"type": "icons-block",
68-
"description": "**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.",
68+
"title": "Icons block title",
69+
"description": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
6970
"items": [
7071
{
7172
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icons-link_1_64.svg",

src/text-transform/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,5 +361,6 @@ export const config: BlocksConfig = {
361361
},
362362
],
363363
[BlockType.CardLayoutBlock]: blockHeaderTransformer,
364+
[BlockType.FilterBlock]: blockHeaderTransformer,
364365
[BlockType.IconsBlock]: blockHeaderTransformer,
365366
};

0 commit comments

Comments
 (0)