@cloud-ru/uikit-product-site-section 0.23.3

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +1406 -0
  2. package/LICENSE +201 -0
  3. package/README.md +335 -0
  4. package/package.json +70 -0
  5. package/src/components/SectionAccordion/SectionAccordion.tsx +99 -0
  6. package/src/components/SectionAccordion/index.ts +1 -0
  7. package/src/components/SectionAccordion/styles.module.scss +13 -0
  8. package/src/components/SectionAccordion/types.ts +11 -0
  9. package/src/components/SectionAccordion/utils.ts +29 -0
  10. package/src/components/SectionBasic/SectionBasic.tsx +157 -0
  11. package/src/components/SectionBasic/index.ts +1 -0
  12. package/src/components/SectionBasic/styles.module.scss +88 -0
  13. package/src/components/SectionBenefits/SectionBenefits.tsx +163 -0
  14. package/src/components/SectionBenefits/components/CardNumeric/CardNumeric.tsx +17 -0
  15. package/src/components/SectionBenefits/components/CardNumeric/index.ts +1 -0
  16. package/src/components/SectionBenefits/components/CardNumeric/styles.module.scss +6 -0
  17. package/src/components/SectionBenefits/components/index.ts +1 -0
  18. package/src/components/SectionBenefits/index.ts +1 -0
  19. package/src/components/SectionBenefits/styles.module.scss +15 -0
  20. package/src/components/SectionBenefits/types.ts +91 -0
  21. package/src/components/SectionBenefitsBanner/SectionBenefitsBanner.tsx +91 -0
  22. package/src/components/SectionBenefitsBanner/index.ts +1 -0
  23. package/src/components/SectionBenefitsBanner/styles.module.scss +119 -0
  24. package/src/components/SectionBenefitsBanner/types.ts +42 -0
  25. package/src/components/SectionBenefitsBanner/utils.ts +15 -0
  26. package/src/components/SectionBlogCarousel/SectionBlogCarousel.tsx +22 -0
  27. package/src/components/SectionBlogCarousel/index.ts +1 -0
  28. package/src/components/SectionBlogCarousel/utils.ts +29 -0
  29. package/src/components/SectionCaseCarousel/SectionCaseCarousel.tsx +22 -0
  30. package/src/components/SectionCaseCarousel/index.ts +1 -0
  31. package/src/components/SectionCaseCarousel/styles.module.scss +3 -0
  32. package/src/components/SectionCaseCarousel/utils.ts +24 -0
  33. package/src/components/SectionCatalog/SectionCatalog.tsx +105 -0
  34. package/src/components/SectionCatalog/constants.ts +5 -0
  35. package/src/components/SectionCatalog/index.ts +1 -0
  36. package/src/components/SectionCatalog/styles.module.scss +45 -0
  37. package/src/components/SectionClientsCarousel/SectionClientsCarousel.tsx +23 -0
  38. package/src/components/SectionClientsCarousel/index.ts +1 -0
  39. package/src/components/SectionClientsCarousel/utils.ts +29 -0
  40. package/src/components/SectionContent/SectionContent.tsx +98 -0
  41. package/src/components/SectionContent/index.ts +1 -0
  42. package/src/components/SectionContent/styles.module.scss +70 -0
  43. package/src/components/SectionContentList/SectionContentList.tsx +99 -0
  44. package/src/components/SectionContentList/index.ts +1 -0
  45. package/src/components/SectionContentList/styles.module.scss +56 -0
  46. package/src/components/SectionContentTabs/SectionContentTabs.tsx +156 -0
  47. package/src/components/SectionContentTabs/index.ts +1 -0
  48. package/src/components/SectionContentTabs/styles.module.scss +85 -0
  49. package/src/components/SectionExpertsCarousel/SectionExpertsCarousel.tsx +18 -0
  50. package/src/components/SectionExpertsCarousel/constants.ts +2 -0
  51. package/src/components/SectionExpertsCarousel/index.ts +1 -0
  52. package/src/components/SectionExpertsCarousel/types.ts +6 -0
  53. package/src/components/SectionLeading/SectionLeading.tsx +116 -0
  54. package/src/components/SectionLeading/index.ts +1 -0
  55. package/src/components/SectionLeading/styles.module.scss +30 -0
  56. package/src/components/SectionLeading/utils.ts +11 -0
  57. package/src/components/SectionMarketplaceCarousel/SectionMarketplaceCarousel.tsx +23 -0
  58. package/src/components/SectionMarketplaceCarousel/index.ts +1 -0
  59. package/src/components/SectionMarketplaceCarousel/utils.ts +33 -0
  60. package/src/components/SectionMedia/SectionMedia.tsx +57 -0
  61. package/src/components/SectionMedia/index.ts +1 -0
  62. package/src/components/SectionMedia/styles.module.scss +9 -0
  63. package/src/components/SectionPersonalManager/SectionPersonalManager.tsx +135 -0
  64. package/src/components/SectionPersonalManager/index.ts +1 -0
  65. package/src/components/SectionPersonalManager/styles.module.scss +146 -0
  66. package/src/components/SectionPersonalManager/utils.ts +15 -0
  67. package/src/components/SectionPromoList/SectionPromoList.tsx +66 -0
  68. package/src/components/SectionPromoList/index.ts +1 -0
  69. package/src/components/SectionPromoList/styles.module.scss +52 -0
  70. package/src/components/SectionSocial/SectionSocial.tsx +66 -0
  71. package/src/components/SectionSocial/constants.ts +5 -0
  72. package/src/components/SectionSocial/index.ts +1 -0
  73. package/src/components/SectionSocial/styles.module.scss +4 -0
  74. package/src/components/SectionTable/SectionTable.tsx +46 -0
  75. package/src/components/SectionTable/index.ts +1 -0
  76. package/src/components/SectionTable/styles.module.scss +19 -0
  77. package/src/components/index.ts +19 -0
  78. package/src/constants.ts +4 -0
  79. package/src/helperComponents/BenefitItem/BenefitItem.tsx +34 -0
  80. package/src/helperComponents/BenefitItem/index.ts +1 -0
  81. package/src/helperComponents/BenefitItem/styles.module.scss +34 -0
  82. package/src/helperComponents/BenefitItem/utils.ts +28 -0
  83. package/src/helperComponents/CardClient/CardClient.tsx +15 -0
  84. package/src/helperComponents/CardClient/index.ts +1 -0
  85. package/src/helperComponents/CardClient/styles.module.scss +25 -0
  86. package/src/helperComponents/CardLeading/CardLeading.tsx +29 -0
  87. package/src/helperComponents/CardLeading/index.ts +2 -0
  88. package/src/helperComponents/CardLeading/styles.module.scss +43 -0
  89. package/src/helperComponents/CardLeading/types.ts +12 -0
  90. package/src/helperComponents/CardLeading/utils.ts +28 -0
  91. package/src/helperComponents/CardSocial/CardSocial.tsx +105 -0
  92. package/src/helperComponents/CardSocial/index.ts +1 -0
  93. package/src/helperComponents/CardSocial/styles.module.scss +48 -0
  94. package/src/helperComponents/CardSocial/utils.ts +13 -0
  95. package/src/helperComponents/Expert/Expert.tsx +28 -0
  96. package/src/helperComponents/Expert/index.ts +1 -0
  97. package/src/helperComponents/Expert/styles.module.scss +39 -0
  98. package/src/helperComponents/PromoList/PromoList.tsx +26 -0
  99. package/src/helperComponents/PromoList/index.ts +1 -0
  100. package/src/helperComponents/PromoList/styles.module.scss +46 -0
  101. package/src/helperComponents/SectionButton/SectionButton.tsx +19 -0
  102. package/src/helperComponents/SectionButton/index.tsx +1 -0
  103. package/src/helperComponents/SectionButton/types.ts +9 -0
  104. package/src/helperComponents/SectionCarousel/SectionCarousel.tsx +109 -0
  105. package/src/helperComponents/SectionCarousel/index.ts +2 -0
  106. package/src/helperComponents/SectionCarousel/styles.module.scss +8 -0
  107. package/src/helperComponents/SectionCarousel/types.ts +42 -0
  108. package/src/helperComponents/SectionCarousel/utils.ts +10 -0
  109. package/src/helperComponents/SectionCatalogFooter/SectionCatalogFooter.tsx +29 -0
  110. package/src/helperComponents/SectionCatalogFooter/index.ts +1 -0
  111. package/src/helperComponents/SectionCatalogFooter/styles.module.scss +10 -0
  112. package/src/helperComponents/SectionTitle/SectionTitle.tsx +72 -0
  113. package/src/helperComponents/SectionTitle/constants.ts +5 -0
  114. package/src/helperComponents/SectionTitle/index.ts +1 -0
  115. package/src/helperComponents/SectionTitle/styles.module.scss +33 -0
  116. package/src/helperComponents/SectionTitle/types.ts +7 -0
  117. package/src/helperComponents/SectionTitle/utils.ts +83 -0
  118. package/src/helperComponents/index.ts +10 -0
  119. package/src/index.ts +2 -0
  120. package/src/types.ts +23 -0
@@ -0,0 +1,52 @@
1
+ @use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables' as var;
2
+
3
+ .sectionPromoList {
4
+ width: 100%;
5
+ position: relative;
6
+ }
7
+
8
+ .cards {
9
+ display: flex;
10
+ gap: 8px;
11
+
12
+ &[data-layout-type='tablet'],
13
+ &[data-layout-type='mobile'] {
14
+ flex-direction: column;
15
+ }
16
+ }
17
+
18
+ .left {
19
+ padding: 32px;
20
+ background-color: var.$sys-invert-neutral-background;
21
+ }
22
+
23
+ .right {
24
+ --image-size: 440px;
25
+ --image-visible-size: 304px;
26
+ padding: 32px;
27
+ position: relative;
28
+ flex-grow: 1;
29
+ background-color: var.$sys-invert-neutral-background;
30
+ background-image: var(--image);
31
+ background-repeat: no-repeat;
32
+ background-size: var(--image-size);
33
+ background-position: calc(100% + var(--image-size) - var(--image-visible-size)) calc(100% + var(--image-size) - var(--image-visible-size));
34
+
35
+ &[data-layout-type='tablet'] {
36
+ --image-visible-size: 300px;
37
+ }
38
+
39
+ &[data-layout-type='mobile'] {
40
+ --image-visible-size: 140px;
41
+ --image-size: 280px;
42
+
43
+ padding: 0 0 var(--image-visible-size);
44
+ background-position-x: center;
45
+ }
46
+ }
47
+
48
+ .rightSectionText {
49
+ &[data-layout-type='mobile'] {
50
+ padding: 32px 32px 0;
51
+ }
52
+ }
@@ -0,0 +1,66 @@
1
+ import cn from 'classnames';
2
+
3
+ import { Grid, GridProps } from '@cloud-ru/uikit-product-site-grid';
4
+ import { extractSupportProps, WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils';
5
+
6
+ import { CardSocial, CardSocialProps } from '../../helperComponents';
7
+ import { SectionColor } from '../../types';
8
+ import { SectionBasic, SectionBasicProps } from '../SectionBasic';
9
+ import { GRID_CONFIG } from './constants';
10
+ import styles from './styles.module.scss';
11
+
12
+ export type SectionSocialProps = WithSupportProps<
13
+ WithLayoutType<
14
+ Pick<SectionBasicProps, 'title' | 'subtitle' | 'titleAlign'> & {
15
+ /** id секции */
16
+ id?: string;
17
+ /** CSS-класс */
18
+ className?: string;
19
+ /** Цвет фона */
20
+ backgroundColor?: SectionColor;
21
+ /** Заголовок */
22
+ title?: string;
23
+
24
+ /** Размер отступов сетки */
25
+ gap?: GridProps['gap'];
26
+ cards: Omit<CardSocialProps, 'layoutType'>[];
27
+ }
28
+ >
29
+ >;
30
+
31
+ export function SectionSocial({
32
+ id,
33
+ layoutType,
34
+ title,
35
+ subtitle,
36
+ backgroundColor,
37
+ className,
38
+ cards,
39
+ titleAlign,
40
+ gap = 's',
41
+ ...rest
42
+ }: SectionSocialProps) {
43
+ return (
44
+ <SectionBasic
45
+ id={id}
46
+ title={title}
47
+ subtitle={subtitle}
48
+ titleAlign={titleAlign}
49
+ backgroundColor={backgroundColor}
50
+ layoutType={layoutType}
51
+ className={cn(className, styles.sectionSocial)}
52
+ {...extractSupportProps(rest)}
53
+ >
54
+ <Grid columnsConfig={GRID_CONFIG} layoutType={layoutType} gap={gap}>
55
+ {cards.map((card, index) => (
56
+ <CardSocial
57
+ {...card}
58
+ key={card.title}
59
+ layoutType={layoutType}
60
+ data-test-id={card['data-test-id'] ?? `section-social__card-${index}`}
61
+ />
62
+ ))}
63
+ </Grid>
64
+ </SectionBasic>
65
+ );
66
+ }
@@ -0,0 +1,5 @@
1
+ export const GRID_CONFIG = {
2
+ desktop: { amount: 2, minWidth: 464 },
3
+ tablet: { amount: 2, minWidth: 328 },
4
+ mobile: { amount: 1, minWidth: 328 },
5
+ };
@@ -0,0 +1 @@
1
+ export * from './SectionSocial';
@@ -0,0 +1,4 @@
1
+ .sectionSocial {
2
+ width: 100%;
3
+ position: relative;
4
+ }
@@ -0,0 +1,46 @@
1
+ import cn from 'classnames';
2
+
3
+ import { RichText } from '@cloud-ru/uikit-product-site-rich-text';
4
+ import { Table, TableProps } from '@cloud-ru/uikit-product-site-table';
5
+ import { extractSupportProps, WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils';
6
+
7
+ import { SectionBasic } from '../SectionBasic';
8
+ import styles from './styles.module.scss';
9
+
10
+ export type SectionTableProps = WithSupportProps<
11
+ WithLayoutType<
12
+ {
13
+ /** id секции */
14
+ id?: string;
15
+ /** CSS-класс */
16
+ className?: string;
17
+ /** Заголовок */
18
+ title?: string;
19
+ /** Подзаголовок */
20
+ subtitle?: string;
21
+ /** Описание */
22
+ description?: string;
23
+ } & TableProps
24
+ >
25
+ >;
26
+
27
+ export function SectionTable({ id, layoutType, className, title, subtitle, description, ...rest }: SectionTableProps) {
28
+ return (
29
+ <SectionBasic
30
+ id={id}
31
+ title={title}
32
+ backgroundColor='neutral-background1-level'
33
+ layoutType={layoutType}
34
+ className={cn(className, styles.sectionTable)}
35
+ {...extractSupportProps(rest)}
36
+ >
37
+ {subtitle && <RichText richText={subtitle} className={styles.subtitle} data-test-id='section-table__subtitle' />}
38
+
39
+ <Table {...rest} data-test-id='section-table__table' />
40
+
41
+ {description && (
42
+ <RichText className={styles.description} richText={description} data-test-id='section-table__description' />
43
+ )}
44
+ </SectionBasic>
45
+ );
46
+ }
@@ -0,0 +1 @@
1
+ export * from './SectionTable';
@@ -0,0 +1,19 @@
1
+ @use '@sbercloud/figma-tokens-web/build/scss/styles-theme-variables' as var;
2
+
3
+ .sectionTable {
4
+ width: 100%;
5
+ position: relative;
6
+ }
7
+
8
+ .subtitle {
9
+ @include var.composite-var(var.$sans-title-m);
10
+
11
+ color: var.$sys-neutral-text-main;
12
+ }
13
+
14
+ .description {
15
+ @include var.composite-var(var.$sans-body-l);
16
+ color: var.$sys-neutral-text-support;
17
+
18
+ word-break: break-word;
19
+ }
@@ -0,0 +1,19 @@
1
+ export * from './SectionAccordion';
2
+ export * from './SectionBasic';
3
+ export * from './SectionBenefits';
4
+ export * from './SectionBenefitsBanner';
5
+ export * from './SectionBlogCarousel';
6
+ export * from './SectionCaseCarousel';
7
+ export * from './SectionCatalog';
8
+ export * from './SectionClientsCarousel';
9
+ export * from './SectionContent';
10
+ export * from './SectionContentList';
11
+ export * from './SectionContentTabs';
12
+ export * from './SectionExpertsCarousel';
13
+ export * from './SectionLeading';
14
+ export * from './SectionMarketplaceCarousel';
15
+ export * from './SectionMedia';
16
+ export * from './SectionPersonalManager';
17
+ export * from './SectionPromoList';
18
+ export * from './SectionSocial';
19
+ export * from './SectionTable';
@@ -0,0 +1,4 @@
1
+ export const SECTION_COLORS = {
2
+ NeutralBackground1Level: 'neutral-background1-level',
3
+ NeutralBackground: 'neutral-background',
4
+ } as const;
@@ -0,0 +1,34 @@
1
+ import { RichText } from '@cloud-ru/uikit-product-site-rich-text';
2
+ import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
3
+ import { Typography } from '@snack-uikit/typography';
4
+
5
+ import styles from './styles.module.scss';
6
+ import { getValueTypographyProps, getValueTypographySubtitleProps } from './utils';
7
+
8
+ export type BenefitItemProps = WithLayoutType<{
9
+ title: string;
10
+ subtitle: string;
11
+ description: string;
12
+ paddingLeftItem?: number;
13
+ }>;
14
+
15
+ export function BenefitItem({ title, subtitle, description, paddingLeftItem, layoutType }: BenefitItemProps) {
16
+ const paddingItem =
17
+ (layoutType === 'desktop' || layoutType === 'desktopSmall') && paddingLeftItem ? paddingLeftItem : 0;
18
+
19
+ return (
20
+ <div className={styles.benefitItem} style={{ paddingLeft: `${paddingItem}px` }} data-layout-type={layoutType}>
21
+ <div className={styles.benefitsTitles}>
22
+ <Typography family='sans' tag='div' {...getValueTypographyProps(layoutType)}>
23
+ <RichText richText={title} />
24
+ </Typography>
25
+ <Typography family='sans' tag='div' {...getValueTypographySubtitleProps(layoutType)}>
26
+ <RichText richText={subtitle} className={styles.subtitleText} data-layout-type={layoutType} />
27
+ </Typography>
28
+ </div>
29
+ <Typography family='sans' tag='div' purpose='body' size='m'>
30
+ <RichText richText={description} />
31
+ </Typography>
32
+ </div>
33
+ );
34
+ }
@@ -0,0 +1 @@
1
+ export * from './BenefitItem';
@@ -0,0 +1,34 @@
1
+ @use '@sbercloud/figma-tokens-web/build/scss/components/styles-tokens-element' as ste;
2
+
3
+ .benefitItem {
4
+ display: flex;
5
+ color: inherit;
6
+
7
+ flex-direction: column;
8
+ gap: ste.$dimension-1m;
9
+
10
+ &[data-layout-type='tablet'] {
11
+ gap: calc(#{ste.$dimension-1m} + #{ste.$dimension-050m});
12
+ max-width: unset;
13
+ }
14
+
15
+ &[data-layout-type='mobile'] {
16
+ gap: unset;
17
+ max-width: unset;
18
+ }
19
+ }
20
+
21
+ .benefitsTitles {
22
+ display: flex;
23
+ gap: ste.$dimension-1m;
24
+ align-items: flex-end;
25
+ }
26
+
27
+ .subtitleText {
28
+ padding-bottom: 8px;
29
+
30
+ &[data-layout-type='tablet'],
31
+ &[data-layout-type='mobile'] {
32
+ padding-bottom: 5px;
33
+ }
34
+ }
@@ -0,0 +1,28 @@
1
+ import { LayoutType } from '@cloud-ru/uikit-product-utils';
2
+ import { TypographyProps } from '@snack-uikit/typography';
3
+
4
+ export function getValueTypographyProps(layoutType: LayoutType): Pick<TypographyProps, 'purpose' | 'size'> {
5
+ switch (layoutType) {
6
+ case 'mobile':
7
+ case 'tablet':
8
+ return { purpose: 'display', size: 's' };
9
+
10
+ case 'desktop':
11
+ case 'desktopSmall':
12
+ default:
13
+ return { purpose: 'display', size: 'l' };
14
+ }
15
+ }
16
+
17
+ export function getValueTypographySubtitleProps(layoutType: LayoutType): Pick<TypographyProps, 'purpose' | 'size'> {
18
+ switch (layoutType) {
19
+ case 'mobile':
20
+ case 'tablet':
21
+ return { purpose: 'title', size: 'm' };
22
+
23
+ case 'desktop':
24
+ case 'desktopSmall':
25
+ default:
26
+ return { purpose: 'headline', size: 's' };
27
+ }
28
+ }
@@ -0,0 +1,15 @@
1
+ import styles from './styles.module.scss';
2
+
3
+ export type CardClientProps = {
4
+ img: string;
5
+ alt: string;
6
+ };
7
+
8
+ export function CardClient({ img, alt }: CardClientProps) {
9
+ return (
10
+ <div className={styles.cardClient}>
11
+ <div className={styles.imageBackground} />
12
+ <img className={styles.image} src={img} alt={alt} />
13
+ </div>
14
+ );
15
+ }
@@ -0,0 +1 @@
1
+ export * from './CardClient';
@@ -0,0 +1,25 @@
1
+ @use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables' as var;
2
+
3
+ .cardClient {
4
+ display: flex;
5
+ flex-direction: column;
6
+ justify-content: center;
7
+ align-items: center;
8
+ position: relative;
9
+ height: 100px;
10
+ }
11
+
12
+ .imageBackground {
13
+ position: absolute;
14
+ width: 100%;
15
+ height: 100%;
16
+ background-color: var.$sys-neutral-background;
17
+ }
18
+
19
+ .image {
20
+ position: relative;
21
+ max-width: 172px;
22
+ max-height: 48px;
23
+ object-fit: cover;
24
+ pointer-events: none;
25
+ }
@@ -0,0 +1,29 @@
1
+ import { extractSupportProps, WithLayoutType } from '@cloud-ru/uikit-product-utils';
2
+ import { Typography } from '@snack-uikit/typography';
3
+
4
+ import styles from './styles.module.scss';
5
+ import { CardLeadingItem } from './types';
6
+ import { getLabelTypographyProps, getValueTypographyProps } from './utils';
7
+
8
+ export type CardLeadingProps = WithLayoutType<CardLeadingItem>;
9
+
10
+ export function CardLeading({ layoutType, value, label, description, image, ...rest }: CardLeadingProps) {
11
+ return (
12
+ <div className={styles.cardLeading} {...extractSupportProps(rest)}>
13
+ <div className={styles.wrapper}>
14
+ <div className={styles.header}>
15
+ <Typography family='sans' {...getValueTypographyProps(layoutType)} className={styles.cardLeadingColor}>
16
+ {value}
17
+ </Typography>
18
+ <Typography family='sans' {...getLabelTypographyProps(layoutType)} className={styles.cardLeadingColor}>
19
+ {label}
20
+ </Typography>
21
+ </div>
22
+ <img className={styles.illustration} src={image} alt='illustration' />
23
+ <div className={styles.footer} data-layout-type={layoutType}>
24
+ <Typography.SansBodyL className={styles.cardLeadingColor}>{description}</Typography.SansBodyL>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ );
29
+ }
@@ -0,0 +1,2 @@
1
+ export * from './CardLeading';
2
+ export * from './types';
@@ -0,0 +1,43 @@
1
+ @use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables' as var;
2
+
3
+ .cardLeading {
4
+ overflow: hidden;
5
+ }
6
+
7
+ .wrapper {
8
+ display: flex;
9
+ flex-direction: column;
10
+ position: relative;
11
+ background-color: var.$sys-neutral-background;
12
+ }
13
+
14
+ .header {
15
+ display: flex;
16
+ flex-direction: row;
17
+ align-items: center;
18
+ gap: var.$dimension-2m;
19
+
20
+ padding: var.$dimension-4m;
21
+
22
+ &[data-layout-type='tablet'],
23
+ &[data-layout-type='mobile'] {
24
+ padding: var.$dimension-3m;
25
+ }
26
+ }
27
+
28
+ .cardLeadingColor {
29
+ color: var.$sys-neutral-text-main;
30
+ }
31
+
32
+ .illustration {
33
+ pointer-events: none;
34
+ }
35
+
36
+ .footer {
37
+ padding: var.$dimension-4m;
38
+
39
+ &[data-layout-type='tablet'],
40
+ &[data-layout-type='mobile'] {
41
+ padding: var.$dimension-3m;
42
+ }
43
+ }
@@ -0,0 +1,12 @@
1
+ import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
2
+
3
+ export type CardLeadingItem = WithSupportProps<{
4
+ /** Заголовок карточки, значение */
5
+ value: string;
6
+ /** Подзаголовок карточки */
7
+ label: string;
8
+ /** Описание карточки */
9
+ description: string;
10
+ /** Ссылка на картинку */
11
+ image: string;
12
+ }>;
@@ -0,0 +1,28 @@
1
+ import { LayoutType } from '@cloud-ru/uikit-product-utils';
2
+ import { TypographyProps } from '@snack-uikit/typography';
3
+
4
+ export const getValueTypographyProps = (layoutType: LayoutType): Pick<TypographyProps, 'purpose' | 'size'> => {
5
+ switch (layoutType) {
6
+ case 'mobile':
7
+ case 'tablet':
8
+ return { purpose: 'headline', size: 'l' };
9
+
10
+ case 'desktop':
11
+ case 'desktopSmall':
12
+ default:
13
+ return { purpose: 'display', size: 'l' };
14
+ }
15
+ };
16
+
17
+ export const getLabelTypographyProps = (layoutType: LayoutType): Pick<TypographyProps, 'purpose' | 'size'> => {
18
+ switch (layoutType) {
19
+ case 'mobile':
20
+ case 'tablet':
21
+ return { purpose: 'label', size: 'l' };
22
+
23
+ case 'desktop':
24
+ case 'desktopSmall':
25
+ default:
26
+ return { purpose: 'title', size: 'm' };
27
+ }
28
+ };
@@ -0,0 +1,105 @@
1
+ import cn from 'classnames';
2
+ import { AnchorHTMLAttributes, MouseEvent } from 'react';
3
+
4
+ import { Icon, IconProps, useCardInteractions } from '@cloud-ru/uikit-product-site-cards';
5
+ import { extractSupportProps, WithLayoutType, WithSupportProps } from '@cloud-ru/uikit-product-utils';
6
+ import { Card } from '@snack-uikit/card';
7
+ import { Typography } from '@snack-uikit/typography';
8
+
9
+ import styles from './styles.module.scss';
10
+ import { getTypographySize } from './utils';
11
+
12
+ export type CardSocialProps = WithSupportProps<
13
+ WithLayoutType<{
14
+ /** Заголовок карточки*/
15
+ title: string;
16
+ /** Описание карточки */
17
+ description?: string;
18
+ /** Ссылка */
19
+ href: string;
20
+ /** HTML-аттрибут target */
21
+ target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];
22
+ /** Колбек клика*/
23
+ onClick?(e?: MouseEvent<HTMLDivElement | HTMLAnchorElement>): void;
24
+ /** Слот под иконку/кастомную ноду */
25
+ icon?: IconProps['icon'];
26
+ /**
27
+ * Является ли деактивированным
28
+ * @default false
29
+ */
30
+ disabled?: boolean;
31
+ /** CSS-класс */
32
+ className?: string;
33
+ }>
34
+ >;
35
+
36
+ export function CardSocial({
37
+ title,
38
+ description,
39
+ icon,
40
+ href,
41
+ target = '_blank',
42
+ onClick,
43
+ disabled = false,
44
+ className,
45
+ layoutType,
46
+ 'data-test-id': dataTestId = 'card-social',
47
+ ...rest
48
+ }: CardSocialProps) {
49
+ const { anchorRef, handleCardKeyDown, handleCardClick, handleLinkClick } = useCardInteractions({
50
+ href,
51
+ onClick,
52
+ disabled,
53
+ });
54
+
55
+ return (
56
+ <Card
57
+ {...extractSupportProps(rest)}
58
+ size='m'
59
+ className={cn(styles.card, className)}
60
+ disabled={disabled}
61
+ onClick={handleCardClick}
62
+ onKeyDown={handleCardKeyDown}
63
+ data-test-id={dataTestId}
64
+ >
65
+ <div data-layout-type={layoutType} className={styles.wrapper}>
66
+ {icon && <Icon size='l' data-test-id={`${dataTestId}__icon`} icon={icon} />}
67
+
68
+ <div className={styles.content}>
69
+ <Typography
70
+ tag='h3'
71
+ family='sans'
72
+ purpose='title'
73
+ size={getTypographySize(layoutType)}
74
+ className={styles.title}
75
+ data-test-id={`${dataTestId}__title`}
76
+ >
77
+ <a
78
+ tabIndex={-1}
79
+ ref={anchorRef}
80
+ href={href}
81
+ target={target}
82
+ onClick={handleLinkClick}
83
+ data-test-id={`${dataTestId}__title-link`}
84
+ >
85
+ {title}
86
+ </a>
87
+ </Typography>
88
+
89
+ {description && (
90
+ <Typography
91
+ tag='h3'
92
+ family='sans'
93
+ purpose='body'
94
+ size={getTypographySize(layoutType)}
95
+ className={styles.description}
96
+ data-test-id={`${dataTestId}__description`}
97
+ >
98
+ {description}
99
+ </Typography>
100
+ )}
101
+ </div>
102
+ </div>
103
+ </Card>
104
+ );
105
+ }
@@ -0,0 +1 @@
1
+ export * from './CardSocial';
@@ -0,0 +1,48 @@
1
+ @use '@sbercloud/figma-tokens-web/build/scss/components/styles-tokens-card' as ste;
2
+
3
+ .card {
4
+ position: relative;
5
+ }
6
+
7
+ .wrapper {
8
+ display: flex;
9
+ flex-direction: row;
10
+ align-items: flex-start;
11
+ gap: 16px;
12
+
13
+ &[data-layout-type=mobile],
14
+ &[data-layout-type=tablet] {
15
+ flex-direction: column;
16
+ gap: 12px;
17
+ }
18
+ }
19
+
20
+ .content {
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-items: flex-start;
24
+ gap: 4px;
25
+ width: 100%;
26
+ }
27
+
28
+ .title {
29
+ color: ste.$sys-neutral-text-main;
30
+
31
+ a {
32
+ color: inherit;
33
+ text-decoration: none;
34
+
35
+ &::before {
36
+ content: '';
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ right: 0;
41
+ bottom: 0;
42
+ }
43
+ }
44
+ }
45
+
46
+ .description {
47
+ color: ste.$sys-neutral-text-support;
48
+ }
@@ -0,0 +1,13 @@
1
+ import { LayoutType } from '@cloud-ru/uikit-product-utils';
2
+ import { TypographyProps } from '@snack-uikit/typography';
3
+
4
+ export const getTypographySize = (layoutType: LayoutType): TypographyProps['size'] => {
5
+ switch (layoutType) {
6
+ case 'tablet':
7
+ case 'mobile':
8
+ return 'm';
9
+
10
+ default:
11
+ return 'l';
12
+ }
13
+ };