Skip to content

Commit 0f1eb62

Browse files
gorgeousvladVladislav Kharitonovqradle-yndx
authored
fix: asset path in new stories (#777)
* fix: asset path in new stories * fix: refactor card-layout storybook --------- Co-authored-by: Vladislav Kharitonov <[email protected]> Co-authored-by: qradle <[email protected]>
1 parent 74e8601 commit 0f1eb62

File tree

3 files changed

+56
-53
lines changed

3 files changed

+56
-53
lines changed
13 KB
Loading

src/blocks/CardLayout/__stories__/CardLayout.stories.tsx

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -43,36 +43,15 @@ const DefaultTemplate: StoryFn<CardLayoutBlockModel> = (args) => (
4343
children: [
4444
{
4545
...data.cards.priceCard,
46-
buttons: [
47-
{
48-
text: 'Button',
49-
url: 'https://example.com',
50-
width: 'max',
51-
theme: 'outlined',
52-
},
53-
],
46+
buttons: [data.buttons.outlined],
5447
},
5548
{
5649
...data.cards.priceCard,
57-
buttons: [
58-
{
59-
text: 'Button',
60-
url: 'https://example.com',
61-
width: 'max',
62-
theme: 'action',
63-
},
64-
],
50+
buttons: [data.buttons.action],
6551
},
6652
{
6753
...data.cards.priceCard,
68-
buttons: [
69-
{
70-
text: 'Button',
71-
url: 'https://example.com',
72-
width: 'max',
73-
theme: 'monochrome',
74-
},
75-
],
54+
buttons: [data.buttons.monochrome],
7655
},
7756
],
7857
},
@@ -168,47 +147,26 @@ const WithBackgroundTemplate: StoryFn<CardLayoutBlockModel> = (args) => (
168147
blocks: [
169148
{
170149
...args,
171-
background: {
172-
src: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/content-bg-img_light.png',
173-
disableCompress: true,
174-
},
150+
background: data.backgrounds.image,
175151
children: createCardArray(8, data.cards.basicCard),
176152
},
177153
{
178154
...args,
179155
title: 'Card layout with background color (basic cards)',
180-
background: {
181-
style: {
182-
backgroundColor: '#EEF2F8',
183-
},
184-
},
156+
background: data.backgrounds.backgroundColor,
185157
children: createCardArray(4, data.cards.basicCard),
186158
},
187159
{
188160
...args,
189-
background: {
190-
border: 'shadow',
191-
style: {
192-
backgroundColor: '#7CCEA0',
193-
},
194-
},
161+
background: data.backgrounds.backgroundColorAndShadow,
195162
title: 'Card layout with background color and shadow (layout items)',
196-
description:
197-
'Three cards in a row on the desktop, three cards in a row on a tablet, one card in a row on a mobile phone.',
198-
colSizes: {
199-
all: 12,
200-
sm: 4,
201-
md: 4,
202-
},
163+
...data.colSizes.threeOne,
203164
children: createCardArray(3, data.cards.layoutItem),
204165
},
205166
{
206167
...args,
207168
title: 'Card layout with background image (price cards)',
208-
background: {
209-
src: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/content-bg-img_light.png',
210-
disableCompress: true,
211-
},
169+
background: data.backgrounds.image,
212170
children: createCardArray(4, data.cards.priceCard),
213171
},
214172
],

src/blocks/CardLayout/__stories__/data.json

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "basic-card",
55
"title": "Tell a story and build a narrative",
66
"text": "We are all storytellers. Stories are a powerful way to communicate ideas and share information. The right story can lead to a better understanding of a situation, make us laugh, or even inspire us to do something in the future.",
7-
"icon": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icon_1_light.svg"
7+
"icon": "/story-assets/icon_1_light.svg"
88
},
99
"layoutItem": {
1010
"type": "layout-item",
@@ -22,12 +22,12 @@
2222
"text": "We are all storytellers. Stories are a powerful way to communicate ideas and share information. The right story can lead to a better understanding of a situation, make us laugh, or even inspire us to do something in the future.",
2323
"background": {
2424
"light": {
25-
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-bg_nopadding_4-12_light.png",
25+
"src": "/story-assets/img-bg_nopadding_4-12_light.png",
2626
"alt": "Lorem ipsumt",
2727
"disableCompress": true
2828
},
2929
"dark": {
30-
"src": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-bg_nopadding_4-12_dark.png",
30+
"src": "/story-assets/img-bg_nopadding_4-12_dark.png",
3131
"alt": "Lorem ipsumt"
3232
}
3333
}
@@ -45,6 +45,43 @@
4545
]
4646
}
4747
},
48+
"buttons": {
49+
"outlined": {
50+
"text": "Button",
51+
"url": "https://example.com",
52+
"width": "max",
53+
"theme": "outlined"
54+
},
55+
"action": {
56+
"text": "Button",
57+
"url": "https://example.com",
58+
"width": "max",
59+
"theme": "action"
60+
},
61+
"monochrome": {
62+
"text": "Button",
63+
"url": "https://example.com",
64+
"width": "max",
65+
"theme": "monochrome"
66+
}
67+
},
68+
"backgrounds": {
69+
"image": {
70+
"src": "/story-assets/content-bg-img_light.png",
71+
"disableCompress": true
72+
},
73+
"backgroundColor": {
74+
"style": {
75+
"backgroundColor": "#EEF2F8"
76+
}
77+
},
78+
"backgroundColorAndShadow": {
79+
"border": "shadow",
80+
"style": {
81+
"backgroundColor": "#7CCEA0"
82+
}
83+
}
84+
},
4885
"default": {
4986
"content": {
5087
"type": "card-layout-block",
@@ -86,6 +123,14 @@
86123
"colSizes": {
87124
"all": 6
88125
}
126+
},
127+
"threeOne": {
128+
"description": "Three cards in a row on the desktop, three cards in a row on a tablet, one card in a row on a mobile phone.",
129+
"colSizes": {
130+
"all": 12,
131+
"sm": 4,
132+
"md": 4
133+
}
89134
}
90135
},
91136
"withBackground": {

0 commit comments

Comments
 (0)