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

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 (168) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +57 -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/Footer/Footer.mobile.js +1 -1
  10. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  11. package/dist/components/Headline/Headline.js +4 -8
  12. package/dist/components/Headline/Headline.js.map +1 -1
  13. package/dist/components/Headline/Headline.mobile.js +4 -2
  14. package/dist/components/Headline/Headline.mobile.js.map +1 -1
  15. package/dist/components/Headline/HeadlineContent.d.ts +2 -2
  16. package/dist/components/Headline/constants.d.ts +10 -0
  17. package/dist/components/Headline/constants.js +25 -0
  18. package/dist/components/Headline/constants.js.map +1 -0
  19. package/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  20. package/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
  21. package/dist/components/ProductBlock/ProductBlockInner.mobile.js +1 -1
  22. package/dist/components/ProductBlock/ProductBlockInner.mobile.js.map +1 -1
  23. package/dist/components/Recommendation/Recommendation.d.ts +5 -0
  24. package/dist/components/Recommendation/Recommendation.js +34 -0
  25. package/dist/components/Recommendation/Recommendation.js.map +1 -0
  26. package/dist/components/Recommendation/RecommendationCard.d.ts +7 -0
  27. package/dist/components/Recommendation/RecommendationCard.js +13 -0
  28. package/dist/components/Recommendation/RecommendationCard.js.map +1 -0
  29. package/dist/components/Recommendation/RecommendationContent.d.ts +14 -0
  30. package/dist/components/Recommendation/RecommendationContent.js +2 -0
  31. package/dist/components/Recommendation/RecommendationContent.js.map +1 -0
  32. package/dist/components/StepsBlock/StepsBlock.mobile.js +28 -6
  33. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  34. package/dist/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  35. package/dist/model/BlockVersion.d.ts +6 -1
  36. package/dist/ui-kit/Description/Description.js +1 -1
  37. package/lib/common.css +1 -1
  38. package/lib/components/Blocks.d.ts +1 -0
  39. package/lib/components/Blocks.js +2 -0
  40. package/lib/components/Blocks.js.map +1 -1
  41. package/lib/components/ContentPage/ContentPageHead.js +1 -1
  42. package/lib/components/ContentPage/ContentPageHead.js.map +1 -1
  43. package/lib/components/Footer/Footer.mobile.js +1 -1
  44. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  45. package/lib/components/Headline/Headline.fixture.d.ts +4 -2
  46. package/lib/components/Headline/Headline.fixture.mobile.d.ts +2 -3
  47. package/lib/components/Headline/Headline.js +4 -8
  48. package/lib/components/Headline/Headline.js.map +1 -1
  49. package/lib/components/Headline/Headline.mobile.js +4 -2
  50. package/lib/components/Headline/Headline.mobile.js.map +1 -1
  51. package/lib/components/Headline/HeadlineContent.d.ts +2 -2
  52. package/lib/components/Headline/constants.d.ts +10 -0
  53. package/lib/components/Headline/constants.js +23 -0
  54. package/lib/components/Headline/constants.js.map +1 -0
  55. package/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  56. package/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
  57. package/lib/components/ProductBlock/ProductBlockInner.mobile.js +1 -1
  58. package/lib/components/ProductBlock/ProductBlockInner.mobile.js.map +1 -1
  59. package/lib/components/Recommendation/Recommendation.d.ts +5 -0
  60. package/lib/components/Recommendation/Recommendation.fixture.d.ts +6 -0
  61. package/lib/components/Recommendation/Recommendation.js +32 -0
  62. package/lib/components/Recommendation/Recommendation.js.map +1 -0
  63. package/lib/components/Recommendation/RecommendationCard.d.ts +7 -0
  64. package/lib/components/Recommendation/RecommendationCard.js +11 -0
  65. package/lib/components/Recommendation/RecommendationCard.js.map +1 -0
  66. package/lib/components/Recommendation/RecommendationContent.d.ts +14 -0
  67. package/lib/components/Recommendation/RecommendationContent.js +2 -0
  68. package/lib/components/Recommendation/RecommendationContent.js.map +1 -0
  69. package/lib/components/StepsBlock/StepsBlock.fixture.mobile.d.ts +1 -4
  70. package/lib/components/StepsBlock/StepsBlock.mobile.js +28 -6
  71. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  72. package/lib/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  73. package/lib/model/BlockVersion.d.ts +6 -1
  74. package/lib/ui-kit/Description/Description.js +1 -1
  75. package/mobile/bundle/bundle.umd.js +69 -23
  76. package/mobile/bundle/bundle.umd.min.js +1 -1
  77. package/mobile/dist/components/ContentPage/ContentPageHead.js +1 -1
  78. package/mobile/dist/components/ContentPage/ContentPageHead.js.map +1 -1
  79. package/mobile/dist/components/Footer/Footer.js +1 -1
  80. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  81. package/mobile/dist/components/Headline/Headline.js +4 -2
  82. package/mobile/dist/components/Headline/Headline.js.map +1 -1
  83. package/mobile/dist/components/Headline/HeadlineContent.d.ts +2 -2
  84. package/mobile/dist/components/Headline/constants.d.ts +10 -0
  85. package/mobile/dist/components/Headline/constants.js +25 -0
  86. package/mobile/dist/components/Headline/constants.js.map +1 -0
  87. package/mobile/dist/components/ProductBlock/ProductBlockInner.js +1 -1
  88. package/mobile/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
  89. package/mobile/dist/components/Recommendation/Recommendation.d.ts +5 -0
  90. package/mobile/dist/components/Recommendation/Recommendation.js +34 -0
  91. package/mobile/dist/components/Recommendation/Recommendation.js.map +1 -0
  92. package/mobile/dist/components/Recommendation/RecommendationCard.d.ts +7 -0
  93. package/mobile/dist/components/Recommendation/RecommendationCard.js +13 -0
  94. package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -0
  95. package/mobile/dist/components/Recommendation/RecommendationContent.d.ts +14 -0
  96. package/mobile/dist/components/Recommendation/RecommendationContent.js +2 -0
  97. package/mobile/dist/components/Recommendation/RecommendationContent.js.map +1 -0
  98. package/mobile/dist/components/StepsBlock/StepsBlock.js +28 -6
  99. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  100. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  101. package/mobile/dist/model/BlockVersion.d.ts +6 -1
  102. package/mobile/dist/ui-kit/Description/Description.js +1 -1
  103. package/mobile/lib/components/ContentPage/ContentPageHead.js +1 -1
  104. package/mobile/lib/components/ContentPage/ContentPageHead.js.map +1 -1
  105. package/mobile/lib/components/Footer/Footer.js +1 -1
  106. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  107. package/mobile/lib/components/Headline/Headline.js +4 -2
  108. package/mobile/lib/components/Headline/Headline.js.map +1 -1
  109. package/mobile/lib/components/Headline/HeadlineContent.d.ts +2 -2
  110. package/mobile/lib/components/Headline/constants.d.ts +10 -0
  111. package/mobile/lib/components/Headline/constants.js +23 -0
  112. package/mobile/lib/components/Headline/constants.js.map +1 -0
  113. package/mobile/lib/components/ProductBlock/ProductBlockInner.js +1 -1
  114. package/mobile/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
  115. package/mobile/lib/components/Recommendation/Recommendation.d.ts +5 -0
  116. package/mobile/lib/components/Recommendation/Recommendation.js +32 -0
  117. package/mobile/lib/components/Recommendation/Recommendation.js.map +1 -0
  118. package/mobile/lib/components/Recommendation/RecommendationCard.d.ts +7 -0
  119. package/mobile/lib/components/Recommendation/RecommendationCard.js +11 -0
  120. package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -0
  121. package/mobile/lib/components/Recommendation/RecommendationContent.d.ts +14 -0
  122. package/mobile/lib/components/Recommendation/RecommendationContent.js +2 -0
  123. package/mobile/lib/components/Recommendation/RecommendationContent.js.map +1 -0
  124. package/mobile/lib/components/StepsBlock/StepsBlock.js +28 -6
  125. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  126. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +2 -0
  127. package/mobile/lib/model/BlockVersion.d.ts +6 -1
  128. package/mobile/lib/ui-kit/Description/Description.js +1 -1
  129. package/mobile/src/components/ContentPage/ContentPage.page.json +74 -0
  130. package/mobile/src/components/ContentPage/ContentPageHead.tsx +1 -1
  131. package/mobile/src/components/Footer/Footer.tsx +2 -2
  132. package/mobile/src/components/Headline/Headline.example.json +1 -1
  133. package/mobile/src/components/Headline/Headline.tsx +25 -4
  134. package/mobile/src/components/Headline/HeadlineContent.ts +2 -3
  135. package/mobile/src/components/Headline/constants.ts +32 -0
  136. package/mobile/src/components/ProductBlock/ProductBlockInner.tsx +3 -1
  137. package/mobile/src/components/Recommendation/Recommendation.example.json +38 -0
  138. package/mobile/src/components/Recommendation/Recommendation.tsx +105 -0
  139. package/mobile/src/components/Recommendation/RecommendationCard.tsx +33 -0
  140. package/mobile/src/components/Recommendation/RecommendationContent.ts +19 -0
  141. package/mobile/src/components/StepsBlock/StepsBlock.tsx +60 -19
  142. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +2 -1
  143. package/mobile/src/model/BlockVersion.ts +7 -1
  144. package/mobile/src/ui-kit/Description/Description.tsx +1 -1
  145. package/package.json +1 -1
  146. package/src/components/Blocks.ts +2 -0
  147. package/src/components/ContentPage/ContentPage.page.json +74 -0
  148. package/src/components/ContentPage/ContentPageHead.tsx +1 -1
  149. package/src/components/Footer/Footer.mobile.tsx +2 -2
  150. package/src/components/Headline/Headline.example.json +1 -1
  151. package/src/components/Headline/Headline.fixture.mobile.tsx +39 -15
  152. package/src/components/Headline/Headline.fixture.tsx +20 -17
  153. package/src/components/Headline/Headline.mobile.tsx +25 -4
  154. package/src/components/Headline/Headline.tsx +10 -12
  155. package/src/components/Headline/HeadlineContent.ts +2 -3
  156. package/src/components/Headline/constants.ts +32 -0
  157. package/src/components/ProductBlock/ProductBlockInner.mobile.tsx +3 -1
  158. package/src/components/ProductBlock/ProductBlockInner.tsx +1 -1
  159. package/src/components/Recommendation/Recommendation.example.json +38 -0
  160. package/src/components/Recommendation/Recommendation.fixture.tsx +73 -0
  161. package/src/components/Recommendation/Recommendation.tsx +105 -0
  162. package/src/components/Recommendation/RecommendationCard.tsx +33 -0
  163. package/src/components/Recommendation/RecommendationContent.ts +19 -0
  164. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +127 -72
  165. package/src/components/StepsBlock/StepsBlock.mobile.tsx +60 -19
  166. package/src/components/StepsBlock/StepsBlockContent.ts +2 -1
  167. package/src/model/BlockVersion.ts +7 -1
  168. package/src/ui-kit/Description/Description.tsx +1 -1
@@ -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,38 @@ 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, HEADLINE_BLOCK_STYLE_MAPS } 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
+ }) => {
20
+ const STYLE_MAPS = HEADLINE_BLOCK_STYLE_MAPS[bgColorHeadline];
12
21
  return (
13
- <section className={`px-4 py-6 ${bgColor} ${className}`}>
14
- {title && <Heading headingType="h2" className="text-primary-text" title={title} />}
22
+ <section className={`px-4 py-6 ${STYLE_MAPS.background} ${className}`}>
23
+ {title && (
24
+ <Heading
25
+ headingType="h2"
26
+ className={`${STYLE_MAPS.text} ${ALIGN_TEXT[align]}`}
27
+ title={title}
28
+ />
29
+ )}
15
30
  {description && (
16
- <p className={`font-normal text-m-md ${title ? 'mt-2.5' : ''}`}>{description}</p>
31
+ <p
32
+ className={`font-normal text-m-md ${STYLE_MAPS.description} ${ALIGN_TEXT[align]} ${
33
+ title ? 'mt-2.5' : ''
34
+ }`}
35
+ >
36
+ {description}
37
+ </p>
17
38
  )}
18
39
  {image?.src && (
19
40
  <div className="mt-5 mx-auto flex justify-center">
@@ -2,27 +2,25 @@ 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, HEADLINE_BLOCK_STYLE_MAPS } 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 }) => {
12
+ const STYLE_MAPS = HEADLINE_BLOCK_STYLE_MAPS[bgColorHeadline];
19
13
  return (
20
- <section className={`p-[50px] ${bgColor} ${className}`}>
14
+ <section className={`p-[50px] ${STYLE_MAPS.background} ${className}`}>
21
15
  {title && (
22
- <Heading headingType="h2" className={`text-primary-text ${textClasses}`} title={title} />
16
+ <Heading
17
+ headingType="h2"
18
+ className={`text-primary-text ${ALIGN_TEXT[align]}`}
19
+ title={title}
20
+ />
23
21
  )}
24
22
  {description && (
25
- <p className={`font-normal text-base mt-4 ${textClasses}`}>{description}</p>
23
+ <p className={`font-normal text-base mt-4 ${ALIGN_TEXT[align]}`}>{description}</p>
26
24
  )}
27
25
  </section>
28
26
  );
@@ -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,32 @@
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
+ type StyleType = {
11
+ background: string;
12
+ text: string;
13
+ description: string;
14
+ };
15
+
16
+ export const HEADLINE_BLOCK_STYLE_MAPS: Record<BlockVersionWithTransparent, StyleType> = {
17
+ transparent: {
18
+ background: 'bg-transparent',
19
+ text: 'text-primary-text',
20
+ description: 'text-primary-text',
21
+ },
22
+ primary: {
23
+ background: 'bg-white',
24
+ text: 'text-primary-text',
25
+ description: 'text-primary-text',
26
+ },
27
+ secondary: {
28
+ background: 'bg-primary-main',
29
+ text: 'text-white',
30
+ description: 'text-white/80',
31
+ },
32
+ };
@@ -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
+ };
@@ -0,0 +1,33 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import type { BlockVersion } from '../../model/BlockVersion';
3
+ import type { UniBlockProps } from '../../types';
4
+ import { Description } from '../../ui-kit/Description/Description';
5
+ import { Heading } from '../../ui-kit/Heading/Heading';
6
+ import { Img } from '../../ui-kit/Img/Img';
7
+ import { List } from '../../ui-kit/List/List';
8
+ import { BaseTile } from '../BaseTile/BaseTile';
9
+ import type { RecommendationCardContent } from './RecommendationContent';
10
+
11
+ export interface RecommendationCardProps extends RecommendationCardContent, UniBlockProps {
12
+ version?: BlockVersion;
13
+ }
14
+
15
+ export const RecommendationCard = JSX<RecommendationCardProps>(
16
+ ({ context, className = '', title, description, items, image, version }) => {
17
+ return (
18
+ <section
19
+ className={`border border-solid box-border rounded-md p-7 min-w-[515px] max-w-[515px] ${className}`}
20
+ role="listitem"
21
+ >
22
+ <BaseTile
23
+ context={context}
24
+ title={title && <Heading headingType="h4" title={title} className="mb-4" />}
25
+ image={image?.src && <Img className="mt-auto ml-7" image={image} />}
26
+ >
27
+ {description ? <Description description={description} /> : null}
28
+ {items?.length ? <List items={items} version={version} /> : null}
29
+ </BaseTile>
30
+ </section>
31
+ );
32
+ },
33
+ );
@@ -0,0 +1,19 @@
1
+ import type { BlockVersion } from '../../model/BlockVersion';
2
+ import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
3
+ import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
4
+ import type { ImageContent } from '../../ui-kit/Img/ImgProps';
5
+ import type { ListContent } from '../../ui-kit/List/ListContent';
6
+
7
+ export type RecommendationCardContent = HeadingContent &
8
+ DescriptionContent &
9
+ ListContent &
10
+ ImageContent;
11
+
12
+ /**
13
+ * @title Рекомендации
14
+ */
15
+ export interface RecommendationContent extends HeadingContent {
16
+ /** @title Карточки */
17
+ recommendations?: RecommendationCardContent[];
18
+ version?: BlockVersion;
19
+ }