Skip to content

Commit 8d3b16d

Browse files
authored
feat: header slider support controls change theme (#1015)
* feat: header slider support controls change theme * feat: header slider support controls change theme: add auto play story
1 parent d9d26b1 commit 8d3b16d

File tree

6 files changed

+103
-2
lines changed

6 files changed

+103
-2
lines changed

src/blocks/Header/Header.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ $backgroundWidth: 1440px;
3030
#{$block}__overtitle {
3131
color: var(--g-color-text-light-primary);
3232
}
33+
34+
#{$block}__description {
35+
.yfm {
36+
color: var(--g-color-text-light-primary);
37+
}
38+
}
3339
}
3440

3541
&_vertical-offset {

src/blocks/Header/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
107107
['has-media']: hasRightSideImage,
108108
['full-width']: fullWidth,
109109
['media-view']: mediaView,
110+
['controls-view']: textTheme,
110111
},
111112
className,
112113
)}
@@ -142,7 +143,7 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
142143
{renderTitle ? renderTitle(title) : <HTML>{title}</HTML>}
143144
</h1>
144145
{description && (
145-
<div className={b('description')}>
146+
<div className={b('description', {theme: textTheme})}>
146147
<YFMWrapper
147148
content={description}
148149
modifiers={{

src/blocks/HeaderSlider/__stories__/HeaderSlider.stories.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,16 @@ const AutoPlayTemplate: StoryFn<HeaderSliderBlockModel> = (args) => (
3232

3333
export const Default = DefaultTemplate.bind({});
3434
export const AutoPlay = AutoPlayTemplate.bind({});
35+
export const WithDifferentSlidesThemes = DefaultTemplate.bind({});
36+
export const WithDifferentSlidesThemesAutoPlay = AutoPlayTemplate.bind({});
3537

3638
Default.args = data.default.content as HeaderSliderBlockProps;
39+
WithDifferentSlidesThemes.args = data.withDifferentSlidesTheme.content as HeaderSliderBlockProps;
3740
AutoPlay.args = {
3841
...data.autoPlay.content,
3942
items: data.default.content.items,
4043
} as HeaderSliderBlockProps;
44+
WithDifferentSlidesThemesAutoPlay.args = {
45+
...data.autoPlay.content,
46+
items: data.withDifferentSlidesTheme.content.items,
47+
} as HeaderSliderBlockProps;

src/blocks/HeaderSlider/__stories__/data.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,62 @@
7676
}
7777
]
7878
}
79+
},
80+
"withDifferentSlidesTheme": {
81+
"content": {
82+
"dots": true,
83+
"randomOrder": false,
84+
"adaptive": true,
85+
"type": "header-slider-block",
86+
"arrows": true,
87+
"items": [
88+
{
89+
"theme": "light",
90+
"title": "Lorem ipsum dolor sit amet",
91+
"description": "Ut enim ad minim veniam, quis nostrud 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",
92+
"width": "s",
93+
"background": {
94+
"image": "/story-assets/header-bg-img_light.png",
95+
"color": "#EFF2F8",
96+
"fullWidth": true
97+
},
98+
"buttons": [
99+
{
100+
"text": "Button\r",
101+
"theme": "action",
102+
"url": "https://example.com"
103+
},
104+
{
105+
"text": "Buttom",
106+
"theme": "outlined",
107+
"url": "https://example.com"
108+
}
109+
]
110+
},
111+
{
112+
"theme": "dark",
113+
"title": "Lorem ipsum dolor sit amet",
114+
"description": "Ut enim ad minim veniam, quis nostrud 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",
115+
"width": "s",
116+
"background": {
117+
"image": "/story-assets/header-bg-img_dark.png",
118+
"color": "#262626",
119+
"fullWidth": true
120+
},
121+
"buttons": [
122+
{
123+
"text": "Button\r",
124+
"theme": "action",
125+
"url": "https://example.com"
126+
},
127+
{
128+
"text": "Buttom",
129+
"theme": "normal-contrast",
130+
"url": "https://example.com"
131+
}
132+
]
133+
}
134+
]
135+
}
79136
}
80137
}

src/blocks/Slider/Arrow/Arrow.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $block: '.#{$ns}slider-block-arrow';
3939
background-color: var(--g-color-base-background);
4040
box-shadow: 0 4px 24px var(--pc-color-sfx-shadow), 0 2px 8px var(--pc-color-sfx-shadow);
4141

42-
transition: box-shadow 0.3s $ease-out-cubic, color 0.3s $ease-out-cubic;
42+
transition: box-shadow 0.3s $ease-out-cubic, color 1s $ease-out-cubic;
4343

4444
@include focusable();
4545
}

src/blocks/Slider/Slider.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ $block: '.#{$ns}SliderBlock';
107107
background-color: var(--g-color-line-generic-accent);
108108
cursor: pointer;
109109

110+
transition: background-color 1s;
111+
110112
&:hover {
111113
background-color: var(--g-color-line-generic-accent-hover);
112114
}
@@ -268,6 +270,34 @@ $block: '.#{$ns}SliderBlock';
268270
}
269271
}
270272

273+
&:has(.slick-active .#{$ns}header-block_controls-view_light) {
274+
.#{$ns}slider-block-arrow__button {
275+
color: var(--g-color-text-dark-primary);
276+
}
277+
278+
.#{$ns}SliderBlock__dot {
279+
background-color: var(--g-color-private-black-150);
280+
281+
&_active {
282+
background-color: var(--g-color-private-black-300);
283+
}
284+
}
285+
}
286+
287+
&:has(.slick-active .#{$ns}header-block_controls-view_dark) {
288+
.#{$ns}slider-block-arrow__button {
289+
color: var(--g-color-text-light-primary);
290+
}
291+
292+
.#{$ns}SliderBlock__dot {
293+
background-color: var(--g-color-private-white-150);
294+
295+
&_active {
296+
background-color: var(--g-color-private-white-300);
297+
}
298+
}
299+
}
300+
271301
.slick-slide {
272302
padding: 0;
273303

0 commit comments

Comments
 (0)