@cloud-ru/uikit-product-site-hero 0.5.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +937 -0
- package/LICENSE +201 -0
- package/README.md +71 -0
- package/package.json +61 -0
- package/src/components/HeroEvent/HeroEvent.tsx +108 -0
- package/src/components/HeroEvent/constants.ts +23 -0
- package/src/components/HeroEvent/index.ts +1 -0
- package/src/components/HeroEvent/styles.module.scss +147 -0
- package/src/components/HeroEvent/types.ts +6 -0
- package/src/components/HeroMain/HeroMain.tsx +159 -0
- package/src/components/HeroMain/components/PlatformLink/PlatformLink.tsx +31 -0
- package/src/components/HeroMain/components/PlatformLink/index.ts +1 -0
- package/src/components/HeroMain/components/index.ts +1 -0
- package/src/components/HeroMain/index.ts +1 -0
- package/src/components/HeroMain/styles.module.scss +154 -0
- package/src/components/HeroMain/utils.ts +17 -0
- package/src/components/HeroSlider/HeroSlider.tsx +72 -0
- package/src/components/HeroSlider/components/HeroSlide/HeroSlide.tsx +70 -0
- package/src/components/HeroSlider/components/HeroSlide/constants.ts +12 -0
- package/src/components/HeroSlider/components/HeroSlide/index.ts +2 -0
- package/src/components/HeroSlider/components/HeroSlide/styles.module.scss +164 -0
- package/src/components/HeroSlider/components/HeroSlide/types.ts +39 -0
- package/src/components/HeroSlider/components/HeroSlide/util.ts +35 -0
- package/src/components/HeroSlider/components/HeroSlideImage/HeroSlideImage.tsx +29 -0
- package/src/components/HeroSlider/components/HeroSlideImage/index.ts +1 -0
- package/src/components/HeroSlider/components/HeroSlideImage/styles.module.scss +31 -0
- package/src/components/HeroSlider/components/HeroSlideImageBg/HeroSlideImageBg.tsx +31 -0
- package/src/components/HeroSlider/components/HeroSlideImageBg/index.ts +1 -0
- package/src/components/HeroSlider/components/HeroSlideImageBg/styles.module.scss +20 -0
- package/src/components/HeroSlider/components/HeroSlideMedia/HeroSlideMedia.tsx +22 -0
- package/src/components/HeroSlider/components/HeroSlideMedia/index.ts +2 -0
- package/src/components/HeroSlider/components/HeroSlideMedia/types.ts +17 -0
- package/src/components/HeroSlider/components/HeroSlideVideoBg/HTMLComment.tsx +36 -0
- package/src/components/HeroSlider/components/HeroSlideVideoBg/HeroSlideVideoBg.tsx +30 -0
- package/src/components/HeroSlider/components/HeroSlideVideoBg/index.ts +1 -0
- package/src/components/HeroSlider/components/index.ts +5 -0
- package/src/components/HeroSlider/index.ts +2 -0
- package/src/components/HeroSlider/styles.module.scss +41 -0
- package/src/components/HeroZero/HeroZero.tsx +84 -0
- package/src/components/HeroZero/index.ts +1 -0
- package/src/components/HeroZero/styles.module.scss +111 -0
- package/src/components/HeroZero/utils.ts +15 -0
- package/src/components/index.ts +4 -0
- package/src/constants.ts +12 -0
- package/src/helperComponents/HeroEventButton/HeroEventButton.tsx +32 -0
- package/src/helperComponents/HeroEventButton/constants.ts +21 -0
- package/src/helperComponents/HeroEventButton/index.ts +1 -0
- package/src/helperComponents/HeroEventButton/types.ts +5 -0
- package/src/helperComponents/HeroNavbar/HeroNavbar.tsx +26 -0
- package/src/helperComponents/HeroNavbar/index.ts +1 -0
- package/src/helperComponents/HeroNavbar/styles.module.scss +13 -0
- package/src/helperComponents/Place/Place.tsx +32 -0
- package/src/helperComponents/Place/constants.ts +34 -0
- package/src/helperComponents/Place/index.ts +1 -0
- package/src/helperComponents/Place/styles.module.scss +3 -0
- package/src/helperComponents/index.tsx +3 -0
- package/src/index.ts +1 -0
- package/src/types.ts +5 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ButtonPromoOutline, ButtonPromoOutlineProps } from '@cloud-ru/uikit-product-button-predefined';
|
|
5
|
+
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
6
|
+
import { Layout } from '@cloud-ru/uikit-product-site-layout';
|
|
7
|
+
import { SiteVideo, SiteVideoProps } from '@cloud-ru/uikit-product-site-media';
|
|
8
|
+
import { SiteNavbar, SiteNavbarProps } from '@cloud-ru/uikit-product-site-navbar';
|
|
9
|
+
import { RichText } from '@cloud-ru/uikit-product-site-rich-text';
|
|
10
|
+
import { TagSpecial, TagSpecialProps } from '@cloud-ru/uikit-product-site-tag';
|
|
11
|
+
import { extractSupportProps, WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
12
|
+
import { Breadcrumbs, BreadcrumbsProps } from '@snack-uikit/breadcrumbs';
|
|
13
|
+
import { ButtonFilled, ButtonFilledProps } from '@snack-uikit/button';
|
|
14
|
+
import { Typography } from '@snack-uikit/typography';
|
|
15
|
+
|
|
16
|
+
import { HeroColor } from '../../types';
|
|
17
|
+
import { PlatformLink, PlatformLinkProps } from './components';
|
|
18
|
+
import styles from './styles.module.scss';
|
|
19
|
+
import { getTitleTypographyProps } from './utils';
|
|
20
|
+
|
|
21
|
+
export type HeroMainProps = WithSupportProps<
|
|
22
|
+
WithLayoutType<{
|
|
23
|
+
/** Заголовок продукта */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Описание продукта */
|
|
26
|
+
description: string;
|
|
27
|
+
/** Ссылка на изображение */
|
|
28
|
+
image?: string;
|
|
29
|
+
/** Видео */
|
|
30
|
+
video?: SiteVideoProps['video'];
|
|
31
|
+
/** Хлебные крошки для продукта */
|
|
32
|
+
breadcrumbs: BreadcrumbsProps['items'];
|
|
33
|
+
/** Тэги */
|
|
34
|
+
tags?: Pick<TagSpecialProps, 'text' | 'appearance' | 'tip'>[];
|
|
35
|
+
/** Платформы */
|
|
36
|
+
platforms?: Array<PlatformLinkProps['platform']>;
|
|
37
|
+
/** Обработка клика по платформе */
|
|
38
|
+
handlePlatformClick?: PlatformLinkProps['handlePlatformClick'];
|
|
39
|
+
/** Цвета фона */
|
|
40
|
+
backgroundColor?: HeroColor;
|
|
41
|
+
/** Массив с настройками кнопок ButtonFilled */
|
|
42
|
+
buttons?: [Omit<ButtonFilledProps, 'size' | 'appearance'>, Omit<ButtonPromoOutlineProps, 'size' | 'appearance'>?];
|
|
43
|
+
/** CSS - класснейм */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** Navbar */
|
|
46
|
+
navbar?: Pick<SiteNavbarProps, 'items' | 'active' | 'onItemClick' | 'topPosition'>;
|
|
47
|
+
}>
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
export function HeroMain({
|
|
51
|
+
title,
|
|
52
|
+
description,
|
|
53
|
+
image,
|
|
54
|
+
video,
|
|
55
|
+
breadcrumbs,
|
|
56
|
+
tags = [],
|
|
57
|
+
platforms = [],
|
|
58
|
+
handlePlatformClick,
|
|
59
|
+
backgroundColor = 'neutral-background1-level',
|
|
60
|
+
buttons,
|
|
61
|
+
navbar,
|
|
62
|
+
layoutType,
|
|
63
|
+
className,
|
|
64
|
+
...rest
|
|
65
|
+
}: HeroMainProps) {
|
|
66
|
+
const { t } = useLocale('SiteHero');
|
|
67
|
+
|
|
68
|
+
const isAdaptive = ['mobile', 'tablet'].includes(layoutType);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<Layout.SectionWrapper
|
|
73
|
+
layoutType={layoutType}
|
|
74
|
+
className={cn(className, styles.sectionWrapper)}
|
|
75
|
+
data-section-background={backgroundColor}
|
|
76
|
+
>
|
|
77
|
+
<div className={styles.contentWrapper} {...extractSupportProps(rest)} data-layout-type={layoutType}>
|
|
78
|
+
<div className={styles.content} data-layout-type={layoutType}>
|
|
79
|
+
<div className={styles.left} data-layout-type={layoutType}>
|
|
80
|
+
<div className={styles.leftContent} data-layout-type={layoutType}>
|
|
81
|
+
<Breadcrumbs size='xs' items={breadcrumbs} data-test-id='hero-main__breadcrumbs' />
|
|
82
|
+
|
|
83
|
+
{tags.length > 0 && (
|
|
84
|
+
<div className={styles.tagRow} data-layout-type={layoutType}>
|
|
85
|
+
{tags.map(({ text, tip, appearance }) => (
|
|
86
|
+
<TagSpecial key={text} text={text} tip={tip} appearance={appearance} />
|
|
87
|
+
))}
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
|
|
91
|
+
<div className={styles.textWrapper}>
|
|
92
|
+
<Typography tag='h1' family='sans' {...getTitleTypographyProps(layoutType)} className={styles.title}>
|
|
93
|
+
<RichText richText={title} />
|
|
94
|
+
</Typography>
|
|
95
|
+
|
|
96
|
+
<Typography.SansBodyL tag='div' className={styles.description}>
|
|
97
|
+
<RichText richText={description} />
|
|
98
|
+
</Typography.SansBodyL>
|
|
99
|
+
|
|
100
|
+
{platforms && platforms.length > 0 && handlePlatformClick && (
|
|
101
|
+
<Typography.SansBodyL tag='p' className={styles.platforms}>
|
|
102
|
+
{t('Main.platforms')}:{' '}
|
|
103
|
+
{platforms.map((platform, index) => (
|
|
104
|
+
<Fragment key={platform.id || platform.title}>
|
|
105
|
+
<PlatformLink platform={platform} handlePlatformClick={handlePlatformClick} />
|
|
106
|
+
{platforms.length - 1 !== index && ', '}
|
|
107
|
+
</Fragment>
|
|
108
|
+
))}
|
|
109
|
+
</Typography.SansBodyL>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
{buttons && buttons.length > 0 && (
|
|
115
|
+
<div className={styles.buttons} data-layout-type={layoutType}>
|
|
116
|
+
<ButtonFilled
|
|
117
|
+
{...buttons[0]}
|
|
118
|
+
data-layout-type={layoutType}
|
|
119
|
+
size='l'
|
|
120
|
+
appearance='primary'
|
|
121
|
+
fullWidth={isAdaptive}
|
|
122
|
+
/>
|
|
123
|
+
{buttons.length > 1 && (
|
|
124
|
+
<ButtonPromoOutline
|
|
125
|
+
{...buttons[1]}
|
|
126
|
+
data-layout-type={layoutType}
|
|
127
|
+
size='l'
|
|
128
|
+
appearance='secondary'
|
|
129
|
+
fullWidth={isAdaptive}
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div className={styles.imageWrapper} data-layout-type={layoutType}>
|
|
137
|
+
<div className={styles.media} data-layout-type={layoutType}>
|
|
138
|
+
{image && <img alt='hero_img' src={image} />}
|
|
139
|
+
|
|
140
|
+
{!image && video && <SiteVideo className={styles.video} video={video} layoutType={layoutType} />}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</Layout.SectionWrapper>
|
|
146
|
+
|
|
147
|
+
{navbar && navbar.items.length > 0 && (
|
|
148
|
+
<Layout.SectionWrapper
|
|
149
|
+
layoutType={layoutType}
|
|
150
|
+
className={cn(styles.sectionWrapper, styles.navbarWrapper)}
|
|
151
|
+
data-sticky={true}
|
|
152
|
+
data-section-background={backgroundColor}
|
|
153
|
+
>
|
|
154
|
+
<SiteNavbar {...navbar} data-test-id='hero-main__navbar' />
|
|
155
|
+
</Layout.SectionWrapper>
|
|
156
|
+
)}
|
|
157
|
+
</>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Link } from '@snack-uikit/link';
|
|
4
|
+
|
|
5
|
+
type Platform = {
|
|
6
|
+
id?: string;
|
|
7
|
+
title: string;
|
|
8
|
+
href: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type PlatformLinkProps = {
|
|
12
|
+
platform: Platform;
|
|
13
|
+
handlePlatformClick(e: MouseEvent<HTMLAnchorElement>, platform: Platform): void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function PlatformLink({ platform, handlePlatformClick }: PlatformLinkProps) {
|
|
17
|
+
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
|
18
|
+
handlePlatformClick(e, platform);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Link
|
|
23
|
+
text={platform.title}
|
|
24
|
+
href={platform.href}
|
|
25
|
+
onClick={handleClick}
|
|
26
|
+
size='l'
|
|
27
|
+
textMode='accent'
|
|
28
|
+
appearance='neutral'
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PlatformLink';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PlatformLink';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HeroMain';
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-web/build/scss/styles-theme-variables' as ds;
|
|
2
|
+
|
|
3
|
+
.sectionWrapper {
|
|
4
|
+
&[data-section-background='neutral-background1-level'] {
|
|
5
|
+
background-color: ds.$sys-neutral-background1-level;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&[data-section-background='neutral-background'] {
|
|
9
|
+
background-color: ds.$sys-neutral-background;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&[data-sticky] {
|
|
13
|
+
position: sticky;
|
|
14
|
+
top: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.contentWrapper {
|
|
19
|
+
padding: ds.$dimension-5m 0;
|
|
20
|
+
|
|
21
|
+
&[data-layout-type='tablet'] {
|
|
22
|
+
padding: ds.$dimension-4m 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&[data-layout-type='mobile'] {
|
|
26
|
+
padding: ds.$dimension-3m 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.content {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: stretch;
|
|
33
|
+
|
|
34
|
+
gap: ds.$dimension-4m;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
|
|
37
|
+
&[data-layout-type='tablet'] {
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[data-layout-type='mobile'] {
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: ds.$dimension-2m;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.left {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
justify-content: space-between;
|
|
51
|
+
flex-grow: 1;
|
|
52
|
+
|
|
53
|
+
gap: ds.$dimension-4m;
|
|
54
|
+
|
|
55
|
+
&[data-layout-type='mobile'] {
|
|
56
|
+
gap: ds.$dimension-3m;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.leftContent {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
|
|
64
|
+
gap: ds.$dimension-4m;
|
|
65
|
+
|
|
66
|
+
&[data-layout-type='mobile'] {
|
|
67
|
+
gap: ds.$dimension-3m;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tagRow {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
gap: ds.$dimension-050m;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.textWrapper {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: ds.$dimension-2m;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.title {
|
|
84
|
+
color: ds.$sys-neutral-text-main;
|
|
85
|
+
word-break: break-word;
|
|
86
|
+
white-space: pre-line;
|
|
87
|
+
max-width: 720px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.description {
|
|
91
|
+
color: ds.$sys-neutral-text-support;
|
|
92
|
+
word-break: break-word;
|
|
93
|
+
max-width: 560px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.platforms {
|
|
97
|
+
color: ds.$sys-neutral-text-main;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.imageWrapper {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
align-items: flex-end;
|
|
104
|
+
align-self: center;
|
|
105
|
+
|
|
106
|
+
&[data-layout-type='tablet'],
|
|
107
|
+
&[data-layout-type='mobile'] {
|
|
108
|
+
align-items: center;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.video {
|
|
113
|
+
height: 300px;
|
|
114
|
+
width: 300px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.media {
|
|
118
|
+
img {
|
|
119
|
+
max-height: 300px;
|
|
120
|
+
max-width: 300px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&[data-layout-type='mobile'] {
|
|
124
|
+
img {
|
|
125
|
+
max-width: 248px;
|
|
126
|
+
max-height: 248px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.video {
|
|
130
|
+
width: 248px;
|
|
131
|
+
height: 248px;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.buttons {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: row;
|
|
139
|
+
gap: ds.$dimension-2m;
|
|
140
|
+
|
|
141
|
+
&[data-layout-type='tablet'] {
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&[data-layout-type='mobile'] {
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
gap: ds.$dimension-1m;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.navbarWrapper {
|
|
152
|
+
/* stylelint-disable-next-line declaration-property-value-allowed-list */
|
|
153
|
+
z-index: 5;
|
|
154
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
2
|
+
import { TypographyProps } from '@snack-uikit/typography';
|
|
3
|
+
|
|
4
|
+
export const getTitleTypographyProps = (layoutType: LayoutType): Pick<TypographyProps, 'size' | 'purpose'> => {
|
|
5
|
+
switch (layoutType) {
|
|
6
|
+
case 'mobile':
|
|
7
|
+
return { purpose: 'headline', size: 'm' };
|
|
8
|
+
|
|
9
|
+
case 'tablet':
|
|
10
|
+
return { purpose: 'headline', size: 'l' };
|
|
11
|
+
|
|
12
|
+
case 'desktop':
|
|
13
|
+
case 'desktopSmall':
|
|
14
|
+
default:
|
|
15
|
+
return { purpose: 'display', size: 'm' };
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { extractSupportProps, WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
import { Carousel, CarouselProps } from '@snack-uikit/carousel';
|
|
6
|
+
import { PaginationSlider } from '@snack-uikit/pagination';
|
|
7
|
+
|
|
8
|
+
import { HeroSlide, HeroSlideProps } from './components';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
|
|
11
|
+
export type HeroSliderProps = WithSupportProps<
|
|
12
|
+
WithLayoutType<
|
|
13
|
+
{
|
|
14
|
+
id?: string;
|
|
15
|
+
/** Слайды карусели */
|
|
16
|
+
items: HeroSlideProps[];
|
|
17
|
+
/** CSS-класс */
|
|
18
|
+
className?: string;
|
|
19
|
+
/** Использовать пагинацию для переключения страниц @default true */
|
|
20
|
+
pagination?: boolean;
|
|
21
|
+
} & Pick<CarouselProps, 'state' | 'autoSwipe'>
|
|
22
|
+
>
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export function HeroSlider({
|
|
26
|
+
id,
|
|
27
|
+
layoutType,
|
|
28
|
+
items,
|
|
29
|
+
autoSwipe,
|
|
30
|
+
pagination = true,
|
|
31
|
+
className,
|
|
32
|
+
...rest
|
|
33
|
+
}: HeroSliderProps) {
|
|
34
|
+
const [currentPage, setCurrentPage] = useState<number>(0);
|
|
35
|
+
|
|
36
|
+
const currentSlideAppearance = items[currentPage].appearance;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<section className={cn(styles.root, className)} id={id}>
|
|
40
|
+
<Carousel
|
|
41
|
+
className={styles.heroCarousel}
|
|
42
|
+
arrows={false}
|
|
43
|
+
pagination={false}
|
|
44
|
+
infiniteScroll
|
|
45
|
+
autoSwipe={autoSwipe}
|
|
46
|
+
state={{
|
|
47
|
+
page: currentPage,
|
|
48
|
+
onChange: setCurrentPage,
|
|
49
|
+
}}
|
|
50
|
+
gap={'0'}
|
|
51
|
+
{...extractSupportProps(rest)}
|
|
52
|
+
>
|
|
53
|
+
{items.map((item, i) => (
|
|
54
|
+
<HeroSlide key={`${item.title}${i}`} {...item} layoutType={layoutType} />
|
|
55
|
+
))}
|
|
56
|
+
</Carousel>
|
|
57
|
+
|
|
58
|
+
{pagination && (
|
|
59
|
+
<div className={styles.paginationWrapper} data-appearance={currentSlideAppearance}>
|
|
60
|
+
<PaginationSlider
|
|
61
|
+
data-test-id='hero-slider__pagination'
|
|
62
|
+
page={currentPage + 1}
|
|
63
|
+
onChange={(page: number) => {
|
|
64
|
+
setCurrentPage(page - 1);
|
|
65
|
+
}}
|
|
66
|
+
total={items.length}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
</section>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { ButtonPromo } from '@cloud-ru/uikit-product-button-predefined';
|
|
4
|
+
import { Layout } from '@cloud-ru/uikit-product-site-layout';
|
|
5
|
+
import { RichText } from '@cloud-ru/uikit-product-site-rich-text';
|
|
6
|
+
import { Erid } from '@cloud-ru/uikit-product-site-tag';
|
|
7
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
8
|
+
import { Typography } from '@snack-uikit/typography';
|
|
9
|
+
|
|
10
|
+
import { HeroSlideMedia } from '../HeroSlideMedia';
|
|
11
|
+
import styles from './styles.module.scss';
|
|
12
|
+
import { HeroSlideProps } from './types';
|
|
13
|
+
import { getSliderContentWrapperImageType, getTitleProps } from './util';
|
|
14
|
+
|
|
15
|
+
type Props = WithLayoutType<HeroSlideProps>;
|
|
16
|
+
|
|
17
|
+
export function HeroSlide({
|
|
18
|
+
layoutType,
|
|
19
|
+
id,
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
media,
|
|
23
|
+
button,
|
|
24
|
+
color,
|
|
25
|
+
appearance,
|
|
26
|
+
erid,
|
|
27
|
+
className,
|
|
28
|
+
}: Props) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
id={id}
|
|
32
|
+
data-layout-type={layoutType}
|
|
33
|
+
data-appearance={appearance}
|
|
34
|
+
data-color={color}
|
|
35
|
+
className={cn(styles.wrapper, className)}
|
|
36
|
+
>
|
|
37
|
+
<Layout.SectionWrapper layoutType={layoutType} className={styles.sectionWrapper}>
|
|
38
|
+
{erid && <Erid className={styles.erid} tip={erid.tip} appearance={erid.appearance} />}
|
|
39
|
+
<div
|
|
40
|
+
className={styles.slideContentWrapper}
|
|
41
|
+
data-layout-type={layoutType}
|
|
42
|
+
data-image-format={getSliderContentWrapperImageType(media)}
|
|
43
|
+
>
|
|
44
|
+
<div
|
|
45
|
+
className={styles.content}
|
|
46
|
+
data-layout-type={layoutType}
|
|
47
|
+
data-image-format={getSliderContentWrapperImageType(media)}
|
|
48
|
+
>
|
|
49
|
+
<div className={styles.text} data-layout-type={layoutType}>
|
|
50
|
+
<Typography family='sans' {...getTitleProps(layoutType)} tag='div'>
|
|
51
|
+
<RichText richText={title} />
|
|
52
|
+
</Typography>
|
|
53
|
+
{description && (
|
|
54
|
+
<Typography.SansBodyL tag='div'>
|
|
55
|
+
<RichText richText={description} />
|
|
56
|
+
</Typography.SansBodyL>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div className={styles.buttonWrapper} data-layout-type={layoutType}>
|
|
61
|
+
<ButtonPromo target='_self' {...button} size='l' appearance='tertiary' className={styles.button} />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<HeroSlideMedia {...media} layoutType={layoutType} />
|
|
66
|
+
</div>
|
|
67
|
+
</Layout.SectionWrapper>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-web/build/scss/styles-theme-variables' as var;
|
|
2
|
+
|
|
3
|
+
$colors: (
|
|
4
|
+
neutral: var.$sys-neutral-background,
|
|
5
|
+
white: var.$sys-neutral-background1-level,
|
|
6
|
+
violet: var.$sys-violet-decor-default,
|
|
7
|
+
blue: var.$sys-blue-decor-default,
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
$decor: 'decor';
|
|
11
|
+
$graphite: 'graphite';
|
|
12
|
+
$brand: 'brand';
|
|
13
|
+
|
|
14
|
+
$rectangle: 'rectangle';
|
|
15
|
+
$square: 'square';
|
|
16
|
+
|
|
17
|
+
@mixin decor-background-colors {
|
|
18
|
+
@each $color, $value in $colors {
|
|
19
|
+
&[data-color='#{$color}'][data-appearance='#{$decor}'] {
|
|
20
|
+
background-color: $value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin appearance {
|
|
26
|
+
&[data-appearance='#{$graphite}'] {
|
|
27
|
+
background-color: var.$sys-graphite-accent-default;
|
|
28
|
+
|
|
29
|
+
.text {
|
|
30
|
+
color: var.$sys-invert-neutral-text-main;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&[data-appearance='#{$brand}'] {
|
|
35
|
+
background-color: var.$sys-primary-accent-default;
|
|
36
|
+
|
|
37
|
+
.text {
|
|
38
|
+
color: var.$sys-graphite-text-main;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-appearance='#{$decor}'] {
|
|
43
|
+
.text {
|
|
44
|
+
color: var.$sys-graphite-text-main;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.wrapper {
|
|
50
|
+
position: relative;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
|
|
54
|
+
background-color: var.$sys-neutral-background;
|
|
55
|
+
|
|
56
|
+
height: 368px;
|
|
57
|
+
|
|
58
|
+
@include decor-background-colors;
|
|
59
|
+
@include appearance;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.sectionWrapper {
|
|
63
|
+
height: 100%;
|
|
64
|
+
|
|
65
|
+
& > div[data-layout-type='tablet'] {
|
|
66
|
+
padding-right: 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.erid {
|
|
71
|
+
position: absolute;
|
|
72
|
+
right: var.$dimension-025m;
|
|
73
|
+
top: var.$dimension-025m;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.slideContentWrapper {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
height: 100%;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
|
|
82
|
+
&[data-layout-type='mobile'] {
|
|
83
|
+
justify-content: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&[data-image-format='#{$rectangle}'] {
|
|
87
|
+
&[data-layout-type='desktop'] {
|
|
88
|
+
gap: var.$dimension-4m;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&[data-layout-type='desktopSmall'] {
|
|
92
|
+
gap: var.$dimension-3m;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&[data-image-format='#{$square}'] {
|
|
97
|
+
gap: var.$dimension-2m;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.content {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
|
|
106
|
+
padding: var.$dimension-7m 0;
|
|
107
|
+
|
|
108
|
+
&[data-layout-type='tablet'] {
|
|
109
|
+
max-width: unset;
|
|
110
|
+
padding: var.$dimension-4m 0 var.$dimension-7m;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&[data-layout-type='mobile'] {
|
|
114
|
+
max-width: unset;
|
|
115
|
+
padding: var.$dimension-3m 0 var.$dimension-7m;
|
|
116
|
+
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&[data-image-format='#{$rectangle}'] {
|
|
121
|
+
&[data-layout-type='desktopSmall'] {
|
|
122
|
+
max-width: 650px;
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&[data-layout-type='tablet'] {
|
|
127
|
+
max-width: 388px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&[data-image-format='#{$square}'] {
|
|
132
|
+
max-width: 800px;
|
|
133
|
+
flex-shrink: 0;
|
|
134
|
+
|
|
135
|
+
&[data-layout-type='tablet'],
|
|
136
|
+
&[data-layout-type='mobile'] {
|
|
137
|
+
max-width: unset;
|
|
138
|
+
flex: initial;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.text {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
|
|
147
|
+
gap: var.$dimension-2m;
|
|
148
|
+
|
|
149
|
+
&[data-layout-type='mobile'] {
|
|
150
|
+
br {
|
|
151
|
+
display: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.buttonWrapper {
|
|
157
|
+
&[data-layout-type='mobile'] {
|
|
158
|
+
.button {
|
|
159
|
+
width: 100%;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|