@redneckz/wildless-cms-uni-blocks 0.3.13 → 0.3.14

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 (140) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +44 -7
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/Blocks.d.ts +1 -0
  5. package/dist/components/Blocks.js +2 -0
  6. package/dist/components/Blocks.js.map +1 -1
  7. package/dist/components/ContentPage/ContentPageHead.js +1 -1
  8. package/dist/components/ContentPage/ContentPageHead.js.map +1 -1
  9. package/dist/components/Headline/Headline.js +3 -8
  10. package/dist/components/Headline/Headline.js.map +1 -1
  11. package/dist/components/Headline/Headline.mobile.js +3 -2
  12. package/dist/components/Headline/Headline.mobile.js.map +1 -1
  13. package/dist/components/Headline/HeadlineContent.d.ts +2 -2
  14. package/dist/components/Headline/constants.d.ts +4 -0
  15. package/dist/components/Headline/constants.js +13 -0
  16. package/dist/components/Headline/constants.js.map +1 -0
  17. package/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  18. package/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
  19. package/dist/components/ProductBlock/ProductBlockInner.mobile.js +1 -1
  20. package/dist/components/ProductBlock/ProductBlockInner.mobile.js.map +1 -1
  21. package/dist/components/Recommendation/Recommendation.d.ts +5 -0
  22. package/dist/components/Recommendation/Recommendation.js +34 -0
  23. package/dist/components/Recommendation/Recommendation.js.map +1 -0
  24. package/dist/components/Recommendation/RecommendationCard.d.ts +7 -0
  25. package/dist/components/Recommendation/RecommendationCard.js +13 -0
  26. package/dist/components/Recommendation/RecommendationCard.js.map +1 -0
  27. package/dist/components/Recommendation/RecommendationContent.d.ts +14 -0
  28. package/dist/components/Recommendation/RecommendationContent.js +2 -0
  29. package/dist/components/Recommendation/RecommendationContent.js.map +1 -0
  30. package/dist/model/BlockVersion.d.ts +6 -1
  31. package/dist/ui-kit/Description/Description.js +1 -1
  32. package/lib/common.css +1 -1
  33. package/lib/components/Blocks.d.ts +1 -0
  34. package/lib/components/Blocks.js +2 -0
  35. package/lib/components/Blocks.js.map +1 -1
  36. package/lib/components/ContentPage/ContentPageHead.js +1 -1
  37. package/lib/components/ContentPage/ContentPageHead.js.map +1 -1
  38. package/lib/components/Headline/Headline.fixture.d.ts +4 -2
  39. package/lib/components/Headline/Headline.fixture.mobile.d.ts +2 -3
  40. package/lib/components/Headline/Headline.js +3 -8
  41. package/lib/components/Headline/Headline.js.map +1 -1
  42. package/lib/components/Headline/Headline.mobile.js +3 -2
  43. package/lib/components/Headline/Headline.mobile.js.map +1 -1
  44. package/lib/components/Headline/HeadlineContent.d.ts +2 -2
  45. package/lib/components/Headline/constants.d.ts +4 -0
  46. package/lib/components/Headline/constants.js +11 -0
  47. package/lib/components/Headline/constants.js.map +1 -0
  48. package/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  49. package/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
  50. package/lib/components/ProductBlock/ProductBlockInner.mobile.js +1 -1
  51. package/lib/components/ProductBlock/ProductBlockInner.mobile.js.map +1 -1
  52. package/lib/components/Recommendation/Recommendation.d.ts +5 -0
  53. package/lib/components/Recommendation/Recommendation.fixture.d.ts +6 -0
  54. package/lib/components/Recommendation/Recommendation.js +32 -0
  55. package/lib/components/Recommendation/Recommendation.js.map +1 -0
  56. package/lib/components/Recommendation/RecommendationCard.d.ts +7 -0
  57. package/lib/components/Recommendation/RecommendationCard.js +11 -0
  58. package/lib/components/Recommendation/RecommendationCard.js.map +1 -0
  59. package/lib/components/Recommendation/RecommendationContent.d.ts +14 -0
  60. package/lib/components/Recommendation/RecommendationContent.js +2 -0
  61. package/lib/components/Recommendation/RecommendationContent.js.map +1 -0
  62. package/lib/model/BlockVersion.d.ts +6 -1
  63. package/lib/ui-kit/Description/Description.js +1 -1
  64. package/mobile/bundle/bundle.umd.js +16 -5
  65. package/mobile/bundle/bundle.umd.min.js +1 -1
  66. package/mobile/dist/components/ContentPage/ContentPageHead.js +1 -1
  67. package/mobile/dist/components/ContentPage/ContentPageHead.js.map +1 -1
  68. package/mobile/dist/components/Headline/Headline.js +3 -2
  69. package/mobile/dist/components/Headline/Headline.js.map +1 -1
  70. package/mobile/dist/components/Headline/HeadlineContent.d.ts +2 -2
  71. package/mobile/dist/components/Headline/constants.d.ts +4 -0
  72. package/mobile/dist/components/Headline/constants.js +13 -0
  73. package/mobile/dist/components/Headline/constants.js.map +1 -0
  74. package/mobile/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  75. package/mobile/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
  76. package/mobile/dist/components/Recommendation/Recommendation.d.ts +5 -0
  77. package/mobile/dist/components/Recommendation/Recommendation.js +34 -0
  78. package/mobile/dist/components/Recommendation/Recommendation.js.map +1 -0
  79. package/mobile/dist/components/Recommendation/RecommendationCard.d.ts +7 -0
  80. package/mobile/dist/components/Recommendation/RecommendationCard.js +13 -0
  81. package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -0
  82. package/mobile/dist/components/Recommendation/RecommendationContent.d.ts +14 -0
  83. package/mobile/dist/components/Recommendation/RecommendationContent.js +2 -0
  84. package/mobile/dist/components/Recommendation/RecommendationContent.js.map +1 -0
  85. package/mobile/dist/model/BlockVersion.d.ts +6 -1
  86. package/mobile/dist/ui-kit/Description/Description.js +1 -1
  87. package/mobile/lib/components/ContentPage/ContentPageHead.js +1 -1
  88. package/mobile/lib/components/ContentPage/ContentPageHead.js.map +1 -1
  89. package/mobile/lib/components/Headline/Headline.js +3 -2
  90. package/mobile/lib/components/Headline/Headline.js.map +1 -1
  91. package/mobile/lib/components/Headline/HeadlineContent.d.ts +2 -2
  92. package/mobile/lib/components/Headline/constants.d.ts +4 -0
  93. package/mobile/lib/components/Headline/constants.js +11 -0
  94. package/mobile/lib/components/Headline/constants.js.map +1 -0
  95. package/mobile/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  96. package/mobile/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
  97. package/mobile/lib/components/Recommendation/Recommendation.d.ts +5 -0
  98. package/mobile/lib/components/Recommendation/Recommendation.js +32 -0
  99. package/mobile/lib/components/Recommendation/Recommendation.js.map +1 -0
  100. package/mobile/lib/components/Recommendation/RecommendationCard.d.ts +7 -0
  101. package/mobile/lib/components/Recommendation/RecommendationCard.js +11 -0
  102. package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -0
  103. package/mobile/lib/components/Recommendation/RecommendationContent.d.ts +14 -0
  104. package/mobile/lib/components/Recommendation/RecommendationContent.js +2 -0
  105. package/mobile/lib/components/Recommendation/RecommendationContent.js.map +1 -0
  106. package/mobile/lib/model/BlockVersion.d.ts +6 -1
  107. package/mobile/lib/ui-kit/Description/Description.js +1 -1
  108. package/mobile/src/components/ContentPage/ContentPage.page.json +74 -0
  109. package/mobile/src/components/ContentPage/ContentPageHead.tsx +1 -1
  110. package/mobile/src/components/Headline/Headline.example.json +1 -1
  111. package/mobile/src/components/Headline/Headline.tsx +20 -4
  112. package/mobile/src/components/Headline/HeadlineContent.ts +2 -3
  113. package/mobile/src/components/Headline/constants.ts +14 -0
  114. package/mobile/src/components/ProductBlock/ProductBlockInner.tsx +3 -1
  115. package/mobile/src/components/Recommendation/Recommendation.example.json +38 -0
  116. package/mobile/src/components/Recommendation/Recommendation.tsx +105 -0
  117. package/mobile/src/components/Recommendation/RecommendationCard.tsx +33 -0
  118. package/mobile/src/components/Recommendation/RecommendationContent.ts +19 -0
  119. package/mobile/src/model/BlockVersion.ts +7 -1
  120. package/mobile/src/ui-kit/Description/Description.tsx +1 -1
  121. package/package.json +1 -1
  122. package/src/components/Blocks.ts +2 -0
  123. package/src/components/ContentPage/ContentPage.page.json +74 -0
  124. package/src/components/ContentPage/ContentPageHead.tsx +1 -1
  125. package/src/components/Headline/Headline.example.json +1 -1
  126. package/src/components/Headline/Headline.fixture.mobile.tsx +39 -15
  127. package/src/components/Headline/Headline.fixture.tsx +20 -17
  128. package/src/components/Headline/Headline.mobile.tsx +20 -4
  129. package/src/components/Headline/Headline.tsx +9 -12
  130. package/src/components/Headline/HeadlineContent.ts +2 -3
  131. package/src/components/Headline/constants.ts +14 -0
  132. package/src/components/ProductBlock/ProductBlockInner.mobile.tsx +3 -1
  133. package/src/components/ProductBlock/ProductBlockInner.tsx +1 -1
  134. package/src/components/Recommendation/Recommendation.example.json +38 -0
  135. package/src/components/Recommendation/Recommendation.fixture.tsx +73 -0
  136. package/src/components/Recommendation/Recommendation.tsx +105 -0
  137. package/src/components/Recommendation/RecommendationCard.tsx +33 -0
  138. package/src/components/Recommendation/RecommendationContent.ts +19 -0
  139. package/src/model/BlockVersion.ts +7 -1
  140. package/src/ui-kit/Description/Description.tsx +1 -1
@@ -1,5 +1,11 @@
1
1
  /**
2
- * @title Цвет плитки
2
+ * @title Цвет блока
3
3
  * @enumNames ["Основная", "Второстепенная"]
4
4
  */
5
5
  export type BlockVersion = 'primary' | 'secondary';
6
+
7
+ /**
8
+ * @title Цвет блока
9
+ * @enumNames ["Прозрачная", Основная", "Второстепенная"]
10
+ */
11
+ export type BlockVersionWithTransparent = 'transparent' | 'primary' | 'secondary';
@@ -8,5 +8,5 @@ export interface DescriptionProps extends DescriptionContent {
8
8
  export const Description = JSX<DescriptionProps>((props) => {
9
9
  const { className = '', description } = props;
10
10
 
11
- return <div className={`font-normal text-m-md ${className}`}>{description}</div>;
11
+ return <div className={`font-normal text-base ${className}`}>{description}</div>;
12
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -17,6 +17,7 @@ import { ProductBlock } from './ProductBlock/ProductBlock';
17
17
  import { ProductGallery } from './ProductGallery/ProductGallery';
18
18
  import { ProductTile } from './ProductTile/ProductTile';
19
19
  import { PromoTile } from './PromoTile/PromoTile';
20
+ import { Recommendation } from './Recommendation/Recommendation';
20
21
  import { StepsBlock } from './StepsBlock/StepsBlock';
21
22
  import { TariffsTable } from './TariffsTable/TariffsTable';
22
23
  import { TextBlock } from './TextBlock/TextBlock';
@@ -40,6 +41,7 @@ export const Blocks = {
40
41
  ProductGallery,
41
42
  ProductTile,
42
43
  PromoTile,
44
+ Recommendation,
43
45
  StepsBlock,
44
46
  TariffsTable,
45
47
  TextBlock,
@@ -1882,6 +1882,80 @@
1882
1882
  "type": "CreditCalculator",
1883
1883
  "style": ["col-span-12"]
1884
1884
  },
1885
+ {
1886
+ "type": "Recommendation",
1887
+ "style": ["col-span-12"],
1888
+ "content": {
1889
+ "title": "С этим продуктом приобретают",
1890
+ "recommendations": [
1891
+ {
1892
+ "title": "Кредиты",
1893
+ "items": ["до 10 000 000 ₽", "до 10 лет"],
1894
+ "image": {
1895
+ "src": "chair.png",
1896
+ "alt": "Варианты потребительского кредита",
1897
+ "format": "webp",
1898
+ "size": {
1899
+ "width": 180,
1900
+ "height": 180
1901
+ }
1902
+ }
1903
+ },
1904
+ {
1905
+ "title": "Кредитные карты",
1906
+ "description": "Льготный период 120 дней",
1907
+ "image": {
1908
+ "src": "credit-card-1.png",
1909
+ "alt": "Варианты потребительского кредита",
1910
+ "format": "webp",
1911
+ "size": {
1912
+ "width": 180,
1913
+ "height": 180
1914
+ }
1915
+ }
1916
+ },
1917
+ {
1918
+ "title": "Кредитные карты",
1919
+ "description": "Льготный период 120 дней",
1920
+ "image": {
1921
+ "src": "credit-card-1.png",
1922
+ "alt": "Варианты потребительского кредита",
1923
+ "format": "webp",
1924
+ "size": {
1925
+ "width": 180,
1926
+ "height": 180
1927
+ }
1928
+ }
1929
+ },
1930
+ {
1931
+ "title": "Кредитные карты",
1932
+ "description": "Льготный период 120 дней",
1933
+ "image": {
1934
+ "src": "credit-card-1.png",
1935
+ "alt": "Варианты потребительского кредита",
1936
+ "format": "webp",
1937
+ "size": {
1938
+ "width": 180,
1939
+ "height": 180
1940
+ }
1941
+ }
1942
+ },
1943
+ {
1944
+ "title": "Кредитные карты",
1945
+ "description": "Льготный период 120 дней",
1946
+ "image": {
1947
+ "src": "credit-card-1.png",
1948
+ "alt": "Варианты потребительского кредита",
1949
+ "format": "webp",
1950
+ "size": {
1951
+ "width": 180,
1952
+ "height": 180
1953
+ }
1954
+ }
1955
+ }
1956
+ ]
1957
+ }
1958
+ },
1885
1959
  {
1886
1960
  "type": "Footer",
1887
1961
  "style": ["col-span-12"],
@@ -28,7 +28,7 @@ export const ContentPageHead = JSX<ContentPageHeadProps>(({ HeadComponent, data,
28
28
  function renderOpenGraph(og: Record<string, string> | undefined) {
29
29
  return og
30
30
  ? Object.entries(og).map(([key, value]) => (
31
- <meta key={key} name={`og:${key}`} content={value} />
31
+ <meta key={key} property={`og:${key}`} content={value} />
32
32
  ))
33
33
  : null;
34
34
  }
@@ -2,5 +2,5 @@
2
2
  "title": "Заголовок",
3
3
  "description": "Описание",
4
4
  "align": "center",
5
- "bgColor": "transparent"
5
+ "bgColorHeadline": "transparent"
6
6
  }
@@ -8,7 +8,7 @@ export const HEADLINE: HeadlineContent = {
8
8
  title: 'Своя кредитная карта',
9
9
  description: 'Карта работает в 180 странах мира. Бесплатное снятие наличных в любых банкоматах.',
10
10
  align: 'center',
11
- bgColor: 'transparent',
11
+ bgColorHeadline: 'transparent',
12
12
  };
13
13
 
14
14
  const image: Picture = {
@@ -20,47 +20,71 @@ const image: Picture = {
20
20
  },
21
21
  };
22
22
 
23
+ const defaultProps: HeadlineContent = {
24
+ title: 'Копите в нескольких валютах',
25
+ description:
26
+ 'Откройте мультивалютный вклад, чтобы распределить свои вложения. Это до 4 счетов в разных валютах внутри одного вклада',
27
+ image: image,
28
+ };
29
+
30
+ const primaryProps: HeadlineContent = {
31
+ ...defaultProps,
32
+ bgColorHeadline: 'primary',
33
+ };
34
+
35
+ const secondaryProps: HeadlineContent = {
36
+ ...defaultProps,
37
+ bgColorHeadline: 'secondary',
38
+ };
39
+
23
40
  export default {
24
41
  default: (
25
42
  <div className="container grid grid-cols-12">
26
- <Headline
27
- className="col-span-12"
28
- context={context}
29
- title="Копите в нескольких валютах"
30
- description="Откройте мультивалютный вклад, чтобы распределить свои вложения. Это до 4 счетов в разных валютах внутри одного вклада"
31
- image={image}
32
- />
43
+ <Headline className="col-span-12" context={context} {...defaultProps} align="left" />
44
+ <Headline className="col-span-12" context={context} {...defaultProps} align="center" />
45
+ <Headline className="col-span-12" context={context} {...defaultProps} align="right" />
33
46
  </div>
34
47
  ),
35
- 'title-img': (
48
+
49
+ primary: (
36
50
  <div className="container grid grid-cols-12">
51
+ <Headline className="col-span-12" context={context} {...primaryProps} align="left" />
52
+ <Headline className="col-span-12" context={context} {...primaryProps} align="center" />
53
+ <Headline className="col-span-12" context={context} {...primaryProps} align="right" />
37
54
  <Headline
38
55
  className="col-span-12"
39
56
  context={context}
40
57
  title="Копите в нескольких валютах"
41
58
  image={image}
59
+ bgColorHeadline="primary"
42
60
  />
43
- </div>
44
- ),
45
- 'desc-img': (
46
- <div className="container grid grid-cols-12">
47
61
  <Headline
48
62
  className="col-span-12"
49
63
  context={context}
50
64
  description="Откройте мультивалютный вклад, чтобы распределить свои вложения. Это до 4 счетов в разных валютах внутри одного вклада"
51
65
  image={image}
66
+ bgColorHeadline="primary"
52
67
  />
53
68
  </div>
54
69
  ),
55
- white: (
70
+ secondary: (
56
71
  <div className="container grid grid-cols-12">
72
+ <Headline className="col-span-12" context={context} {...secondaryProps} align="left" />
73
+ <Headline className="col-span-12" context={context} {...secondaryProps} align="center" />
74
+ <Headline className="col-span-12" context={context} {...secondaryProps} align="right" />
57
75
  <Headline
58
76
  className="col-span-12"
59
77
  context={context}
60
78
  title="Копите в нескольких валютах"
79
+ image={image}
80
+ bgColorHeadline="secondary"
81
+ />
82
+ <Headline
83
+ className="col-span-12"
84
+ context={context}
61
85
  description="Откройте мультивалютный вклад, чтобы распределить свои вложения. Это до 4 счетов в разных валютах внутри одного вклада"
62
- bgColor="bg-white"
63
86
  image={image}
87
+ bgColorHeadline="secondary"
64
88
  />
65
89
  </div>
66
90
  ),
@@ -7,35 +7,38 @@ export const HEADLINE: HeadlineContent = {
7
7
  title: 'Своя кредитная карта',
8
8
  description: 'Карта работает в 180 странах мира. Бесплатное снятие наличных в любых банкоматах.',
9
9
  align: 'center',
10
- bgColor: 'transparent',
10
+ };
11
+
12
+ export const HEADLINE_PRIMARY: HeadlineContent = {
13
+ ...HEADLINE,
14
+ bgColorHeadline: 'primary',
15
+ };
16
+
17
+ export const HEADLINE_SECONDARY: HeadlineContent = {
18
+ ...HEADLINE,
19
+ bgColorHeadline: 'secondary',
11
20
  };
12
21
 
13
22
  export default {
14
23
  default: (
15
24
  <div className="container grid grid-cols-12">
16
25
  <Headline className="col-span-12" context={context} {...HEADLINE} />
26
+ <Headline className="col-span-12" context={context} {...HEADLINE} align="left" />
27
+ <Headline className="col-span-12" context={context} {...HEADLINE} align="right" />
17
28
  </div>
18
29
  ),
19
- 'left white': (
30
+ primary: (
20
31
  <div className="container grid grid-cols-12">
21
- <Headline
22
- className="col-span-12"
23
- context={context}
24
- {...HEADLINE}
25
- align="left"
26
- bgColor="bg-white"
27
- />
32
+ <Headline className="col-span-12" context={context} {...HEADLINE_PRIMARY} />
33
+ <Headline className="col-span-12" context={context} {...HEADLINE_PRIMARY} align="left" />
34
+ <Headline className="col-span-12" context={context} {...HEADLINE_PRIMARY} align="right" />
28
35
  </div>
29
36
  ),
30
- 'right transparent': (
37
+ secondary: (
31
38
  <div className="container grid grid-cols-12">
32
- <Headline
33
- className="col-span-12"
34
- context={context}
35
- {...HEADLINE}
36
- align="right"
37
- bgColor="transparent"
38
- />
39
+ <Headline className="col-span-12" context={context} {...HEADLINE_SECONDARY} />
40
+ <Headline className="col-span-12" context={context} {...HEADLINE_SECONDARY} align="left" />
41
+ <Headline className="col-span-12" context={context} {...HEADLINE_SECONDARY} align="right" />
39
42
  </div>
40
43
  ),
41
44
  };
@@ -3,17 +3,33 @@ import { JSX } from '@redneckz/uni-jsx';
3
3
  import type { UniBlockProps } from '../../types';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
5
  import { Img } from '../../ui-kit/Img/Img';
6
+ import { ALIGN_TEXT, BACKGROUND_COLOR } from './constants';
6
7
  import type { HeadlineContent } from './HeadlineContent';
7
8
 
8
9
  export interface HeadlineProps extends UniBlockProps, HeadlineContent {}
9
10
 
10
11
  export const Headline = JSX<HeadlineProps>(
11
- ({ bgColor = 'transparent', className = '', title, description, image }) => {
12
+ ({
13
+ bgColorHeadline = 'transparent',
14
+ className = '',
15
+ title,
16
+ description,
17
+ image,
18
+ align = 'left',
19
+ }) => {
12
20
  return (
13
- <section className={`px-4 py-6 ${bgColor} ${className}`}>
14
- {title && <Heading headingType="h2" className="text-primary-text" title={title} />}
21
+ <section className={`px-4 py-6 ${BACKGROUND_COLOR[bgColorHeadline]} ${className}`}>
22
+ {title && (
23
+ <Heading
24
+ headingType="h2"
25
+ className={`text-primary-text ${ALIGN_TEXT[align]}`}
26
+ title={title}
27
+ />
28
+ )}
15
29
  {description && (
16
- <p className={`font-normal text-m-md ${title ? 'mt-2.5' : ''}`}>{description}</p>
30
+ <p className={`font-normal text-m-md ${ALIGN_TEXT[align]} ${title ? 'mt-2.5' : ''}`}>
31
+ {description}
32
+ </p>
17
33
  )}
18
34
  {image?.src && (
19
35
  <div className="mt-5 mx-auto flex justify-center">
@@ -2,27 +2,24 @@ import { JSX } from '@redneckz/uni-jsx';
2
2
 
3
3
  import type { UniBlockProps } from '../../types';
4
4
  import { Heading } from '../../ui-kit/Heading/Heading';
5
- import { AlignType } from '../BaseTile/BaseTileProps';
5
+ import { ALIGN_TEXT, BACKGROUND_COLOR } from './constants';
6
6
  import type { HeadlineContent } from './HeadlineContent';
7
7
 
8
8
  export interface HeadlineProps extends UniBlockProps, HeadlineContent {}
9
9
 
10
- const alignText: Record<AlignType, string> = {
11
- left: 'text-left',
12
- center: 'text-center',
13
- right: 'text-right',
14
- };
15
-
16
10
  export const Headline = JSX<HeadlineProps>(
17
- ({ bgColor = 'transparent', align = 'left', className = '', title, description }) => {
18
- const textClasses = alignText[align];
11
+ ({ bgColorHeadline = 'transparent', align = 'left', className = '', title, description }) => {
19
12
  return (
20
- <section className={`p-[50px] ${bgColor} ${className}`}>
13
+ <section className={`p-[50px] ${BACKGROUND_COLOR[bgColorHeadline]} ${className}`}>
21
14
  {title && (
22
- <Heading headingType="h2" className={`text-primary-text ${textClasses}`} title={title} />
15
+ <Heading
16
+ headingType="h2"
17
+ className={`text-primary-text ${ALIGN_TEXT[align]}`}
18
+ title={title}
19
+ />
23
20
  )}
24
21
  {description && (
25
- <p className={`font-normal text-base mt-4 ${textClasses}`}>{description}</p>
22
+ <p className={`font-normal text-base mt-4 ${ALIGN_TEXT[align]}`}>{description}</p>
26
23
  )}
27
24
  </section>
28
25
  );
@@ -1,4 +1,4 @@
1
- import type { BgColorVersion } from '../../model/BgColorVersion';
1
+ import type { BlockVersionWithTransparent } from '../../model/BlockVersion';
2
2
  import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
3
3
  import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
4
4
  import type { ImageContent } from '../../ui-kit/Img/ImgProps';
@@ -11,6 +11,5 @@ export type HeadlineContent = HeadingContent &
11
11
  DescriptionContent &
12
12
  ImageContent & {
13
13
  align?: AlignType;
14
- // TODO: image for mobile
15
- bgColor?: BgColorVersion;
14
+ bgColorHeadline?: BlockVersionWithTransparent;
16
15
  };
@@ -0,0 +1,14 @@
1
+ import type { AlignType } from '../BaseTile/BaseTileProps';
2
+ import type { BlockVersionWithTransparent } from '../../model/BlockVersion';
3
+
4
+ export const ALIGN_TEXT: Record<AlignType, string> = {
5
+ left: 'text-left',
6
+ center: 'text-center',
7
+ right: 'text-right',
8
+ };
9
+
10
+ export const BACKGROUND_COLOR: Record<BlockVersionWithTransparent, string> = {
11
+ transparent: 'bg-transparent',
12
+ primary: 'bg-white',
13
+ secondary: 'bg-primary-main',
14
+ };
@@ -48,7 +48,9 @@ export const ProductBlockInner = JSX<ProductBlockInnerProps>(
48
48
  ) : null
49
49
  }
50
50
  >
51
- {description ? <Description className="mt-3" description={description} /> : null}
51
+ {description ? (
52
+ <Description className="mt-3 text-m-md" description={description} />
53
+ ) : null}
52
54
  {benefits?.filter((items) => items.label)?.length ? (
53
55
  <div className="mt-3">{benefits.map((_, i) => renderBenefit(_, i, version))}</div>
54
56
  ) : null}
@@ -45,7 +45,7 @@ export const ProductBlockInner = JSX<ProductBlockInnerProps>(
45
45
  }
46
46
  >
47
47
  {description && (
48
- <Description className="text-m-base mt-4 max-w-[600px]" description={description} />
48
+ <Description className="mt-4 max-w-[600px]" description={description} />
49
49
  )}
50
50
  {benefits?.filter((items) => items.label)?.length ? (
51
51
  <div className="flex gap-6 mt-6">
@@ -0,0 +1,38 @@
1
+ {
2
+ "title": "Блок рекомендаций",
3
+ "recommendations": [
4
+ {
5
+ "image": {
6
+ "format": "webp",
7
+ "size": {
8
+ "width": 180,
9
+ "height": 180
10
+ }
11
+ },
12
+ "title": "Заголовок 1",
13
+ "description": "Описание 1"
14
+ },
15
+ {
16
+ "image": {
17
+ "format": "webp",
18
+ "size": {
19
+ "width": 180,
20
+ "height": 180
21
+ }
22
+ },
23
+ "title": "Заголовок 2",
24
+ "description": "Описание 2"
25
+ },
26
+ {
27
+ "image": {
28
+ "format": "webp",
29
+ "size": {
30
+ "width": 180,
31
+ "height": 180
32
+ }
33
+ },
34
+ "title": "Заголовок 3",
35
+ "description": "Описание 3"
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,73 @@
1
+ import type { Picture } from '../../model/Picture';
2
+ import { context } from '../../setup-fixture';
3
+ import { Recommendation, RecommendationProps } from './Recommendation';
4
+
5
+ const creditCard: Picture = {
6
+ src: 'credit-card-1.png',
7
+ format: 'webp',
8
+ size: {
9
+ width: 180,
10
+ height: 180,
11
+ },
12
+ title: 'credit-card-1',
13
+ };
14
+
15
+ const chair: Picture = {
16
+ src: 'chair.png',
17
+ format: 'webp',
18
+ size: {
19
+ width: 180,
20
+ height: 180,
21
+ },
22
+ title: 'chair',
23
+ };
24
+
25
+ export const defaultProps: RecommendationProps = {
26
+ context,
27
+ title: 'С этим продуктом приобретают',
28
+ recommendations: [
29
+ {
30
+ title: 'Кредиты',
31
+ items: ['до 10 000 000 ₽', 'до 10 лет'],
32
+ image: chair,
33
+ },
34
+ {
35
+ title: 'Кредитные карты',
36
+ description: 'Льготный период 120 дней',
37
+ image: creditCard,
38
+ },
39
+ {
40
+ title: 'Кредитные карты',
41
+ description: 'Льготный период 120 дней',
42
+ image: creditCard,
43
+ },
44
+ {
45
+ title: 'Кредитные карты',
46
+ description: 'Льготный период 120 дней',
47
+ image: creditCard,
48
+ },
49
+ {
50
+ title: 'Кредитные карты',
51
+ description: 'Льготный период 120 дней',
52
+ image: creditCard,
53
+ },
54
+ ],
55
+ };
56
+
57
+ export default {
58
+ default: (
59
+ <div>
60
+ <div className="container grid grid-cols-12" data-theme="pc">
61
+ <Recommendation className="col-span-12 mb-1" version="secondary" {...defaultProps} />
62
+ </div>
63
+
64
+ <div className="container grid grid-cols-12" data-theme="bc">
65
+ <Recommendation className="col-span-12 mb-1" version="secondary" {...defaultProps} />
66
+ </div>
67
+
68
+ <div className="container grid grid-cols-12 mb-1">
69
+ <Recommendation className="col-span-12" {...defaultProps} />
70
+ </div>
71
+ </div>
72
+ ),
73
+ };
@@ -0,0 +1,105 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { UniBlockProps } from '../../types';
3
+ import { ArrowButton } from '../../ui-kit/Button/ArrowButton';
4
+ import { Heading } from '../../ui-kit/Heading/Heading';
5
+ import { RecommendationCard } from './RecommendationCard';
6
+ import type { RecommendationCardContent, RecommendationContent } from './RecommendationContent';
7
+
8
+ const BLUR_BLOCK_CLASSES = 'absolute top-0 bottom-0 w-[84px]';
9
+ const CARD_FULL_VIEW_COUNT = 2;
10
+ const CARD_SHIFT = 525;
11
+
12
+ export interface RecommendationProps extends RecommendationContent, UniBlockProps {}
13
+
14
+ export const Recommendation = JSX<RecommendationProps>(
15
+ ({ context, recommendations = [], className = '', title, version }) => {
16
+ const [activeCardIndex, setActiveCardIndex] = context.useState(0);
17
+
18
+ const blockClassName =
19
+ version === 'secondary' ? 'bg-primary-main text-white' : 'bg-white text-primary-text';
20
+ const cardClassName = version === 'secondary' ? 'border-main-divider' : 'border-main-stroke';
21
+
22
+ return (
23
+ <section
24
+ className={`relative font-sans p-[50px] overflow-hidden ${blockClassName} ${className}`}
25
+ >
26
+ {title ? <Heading headingType="h3" className="mb-8" title={title} /> : null}
27
+ <div
28
+ className="flex duration-1000 gap-4"
29
+ style={{ transform: `translateX(-${activeCardIndex * CARD_SHIFT}px)` }}
30
+ role="list"
31
+ >
32
+ {recommendations?.length
33
+ ? recommendations.map(
34
+ renderRecommendationCard({ context, version, className: cardClassName }),
35
+ )
36
+ : null}
37
+ </div>
38
+ {renderNavButtons({
39
+ cardsCount: recommendations.length,
40
+ activeCardIndex,
41
+ setActiveCardIndex,
42
+ })}
43
+ <div
44
+ className={`${BLUR_BLOCK_CLASSES} left-0 ${
45
+ version === 'secondary' ? 'bg-opacity-from-main' : 'bg-opacity-from-white'
46
+ }`}
47
+ />
48
+ <div
49
+ className={`${BLUR_BLOCK_CLASSES} right-0 ${
50
+ version === 'secondary' ? 'bg-opacity-to-main' : 'bg-opacity-to-white'
51
+ }`}
52
+ />
53
+ </section>
54
+ );
55
+ },
56
+ );
57
+
58
+ const renderRecommendationCard =
59
+ ({ context, version, className }) =>
60
+ (card: RecommendationCardContent, i: number) => {
61
+ return (
62
+ <RecommendationCard
63
+ key={String(i)}
64
+ context={context}
65
+ {...card}
66
+ version={version}
67
+ className={className}
68
+ />
69
+ );
70
+ };
71
+
72
+ const renderNavButtons = ({
73
+ cardsCount,
74
+ activeCardIndex,
75
+ setActiveCardIndex,
76
+ }: {
77
+ cardsCount: number;
78
+ activeCardIndex: number;
79
+ setActiveCardIndex: (number) => void;
80
+ }) => {
81
+ const handleNextClick = () => setActiveCardIndex(activeCardIndex + 1);
82
+ const handlePrevClick = () => setActiveCardIndex(activeCardIndex - 1);
83
+ const isUseSlider = cardsCount > CARD_FULL_VIEW_COUNT;
84
+ const showNextButton = isUseSlider && cardsCount - activeCardIndex > CARD_FULL_VIEW_COUNT;
85
+ const showPrevButton = isUseSlider && activeCardIndex > 0;
86
+
87
+ return (
88
+ <div>
89
+ {showPrevButton && (
90
+ <ArrowButton
91
+ className="absolute top-1/2 left-8 rotate-180 z-10 mt-6"
92
+ onClick={handlePrevClick}
93
+ ariaLabel="Пролистать влево"
94
+ />
95
+ )}
96
+ {showNextButton && (
97
+ <ArrowButton
98
+ className="absolute top-1/2 right-8 z-10 mt-6"
99
+ onClick={handleNextClick}
100
+ ariaLabel="Пролистать вправо"
101
+ />
102
+ )}
103
+ </div>
104
+ );
105
+ };