Skip to content

Commit 8be4e48

Browse files
author
berdysheva
committed
feat: refactoring storybook pt2
1 parent 8cdf1ec commit 8be4e48

File tree

12 files changed

+344
-392
lines changed

12 files changed

+344
-392
lines changed

src/blocks/Media/__stories__/data.json

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,28 @@
6262
"staticWithAutoPlay": {
6363
"title": "Video with auto loop and without controls",
6464
"media": {
65-
"video": {
66-
"src": [
67-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.webm",
68-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.mp4",
69-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png"
70-
],
71-
"loop": {
72-
"start": 0
65+
"light": {
66+
"video": {
67+
"src": [
68+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.webm",
69+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.mp4",
70+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png"
71+
],
72+
"loop": {
73+
"start": 0
74+
}
75+
}
76+
},
77+
"dark": {
78+
"video": {
79+
"src": [
80+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.webm",
81+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.mp4",
82+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.png"
83+
],
84+
"loop": {
85+
"start": 0
86+
}
7387
}
7488
}
7589
}
@@ -87,6 +101,17 @@
87101
],
88102
"autoplay": false
89103
}
104+
},
105+
"dark": {
106+
"video": {
107+
"type": "player",
108+
"src": [
109+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.webm",
110+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.mp4",
111+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.png"
112+
],
113+
"autoplay": false
114+
}
90115
}
91116
}
92117
},
@@ -99,15 +124,29 @@
99124
"youtubeWithPreview": {
100125
"title": "Video with preview image and play button",
101126
"media": {
102-
"previewImg": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png",
103-
"video": {
104-
"type": "player",
105-
"src": [
106-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.webm",
107-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.mp4",
108-
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png"
109-
],
110-
"autoplay": false
127+
"light": {
128+
"previewImg": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png",
129+
"video": {
130+
"type": "player",
131+
"src": [
132+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.webm",
133+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.mp4",
134+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_white.png"
135+
],
136+
"autoplay": false
137+
}
138+
},
139+
"dark": {
140+
"previewImg": "https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.png",
141+
"video": {
142+
"type": "player",
143+
"src": [
144+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.webm",
145+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.mp4",
146+
"https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/video_8-12_dark.png"
147+
],
148+
"autoplay": false
149+
}
111150
}
112151
}
113152
}
@@ -116,11 +155,11 @@
116155
"content": {
117156
"media": {
118157
"light": {
119-
"dataLens": "zqx9je64n9bws"
158+
"dataLens": "m2bzon9y39lck"
120159
},
121160
"dark": {
122161
"dataLens": {
123-
"id": "zqx9je64n9bws",
162+
"id": "m2bzon9y39lck",
124163
"theme": "dark"
125164
}
126165
}

src/blocks/PromoFeaturesBlock/PromoFeaturesBlock.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ $block: '.#{$ns}PromoFeaturesBlock';
4545
flex-direction: column;
4646
justify-content: center;
4747
border-radius: $borderRadius;
48+
overflow: hidden;
4849

4950
&-info {
5051
padding: $indentM $indentM 0 $indentM;

src/blocks/PromoFeaturesBlock/__stories__/PromoFeaturesBlock.stories.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Meta, Story} from '@storybook/react/types-6-0';
22
import React from 'react';
3+
import yfm from '@doc-tools/transform';
34

45
import PromoFeaturesBlock from '../PromoFeaturesBlock';
56
import {PromoFeaturesBlockModel, PromoFeaturesProps} from '../../../models';
@@ -22,5 +23,28 @@ const DefaultTemplate: Story<PromoFeaturesBlockModel> = (args) => (
2223
export const DefaultTheme = DefaultTemplate.bind({});
2324
export const GreyTheme = DefaultTemplate.bind({});
2425

25-
DefaultTheme.args = data.defaultTheme.content as PromoFeaturesProps;
26-
GreyTheme.args = data.greyTheme.content as PromoFeaturesProps;
26+
const DefaultArgs = {
27+
...data.common,
28+
description: yfm(data.common.description).result.html,
29+
};
30+
31+
DefaultTheme.args = {
32+
...DefaultArgs,
33+
...data.defaultTheme.content,
34+
items: data.defaultTheme.content.items.map((item) => {
35+
return {
36+
...item,
37+
text: yfm(item.text).result.html,
38+
};
39+
}),
40+
} as PromoFeaturesProps;
41+
GreyTheme.args = {
42+
...DefaultArgs,
43+
...data.greyTheme.content,
44+
items: data.greyTheme.content.items.map((item) => {
45+
return {
46+
...item,
47+
text: yfm(item.text).result.html,
48+
};
49+
}),
50+
} as PromoFeaturesProps;

0 commit comments

Comments
 (0)