@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
@@ -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">
@@ -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}
@@ -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,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
+ }
@@ -1,26 +1,62 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { SizeVersion } from '../../model/SizeVersion';
3
- import type { UniBlockProps } from '../../types';
4
2
  import { Heading } from '../../ui-kit/Heading/Heading';
5
3
  import { Icon } from '../../ui-kit/Icon/Icon';
4
+ import type { SizeVersion } from '../../model/SizeVersion';
5
+ import type { UniBlockProps } from '../../types';
6
6
  import type { Step, StepsBlockContent } from './StepsBlockContent';
7
+ import type { BlockVersion } from '../../model/BlockVersion';
7
8
 
8
9
  export interface StepsBlockProps extends StepsBlockContent, UniBlockProps {}
9
10
 
11
+ type StyleType = {
12
+ background: string;
13
+ title: string;
14
+ description: string;
15
+ iconBackground: string;
16
+ iconConnector: string;
17
+ };
18
+
19
+ const STEPS_BLOCK_STYLE_MAPS: Record<BlockVersion, StyleType> = {
20
+ primary: {
21
+ background: 'bg-white',
22
+ title: 'text-primary-text',
23
+ description: 'text-secondary-text',
24
+ iconBackground: 'bg-secondary-light',
25
+ iconConnector: 'bg-secondary-light',
26
+ },
27
+ secondary: {
28
+ background: 'bg-primary-main',
29
+ title: 'text-white',
30
+ description: 'text-white/80',
31
+ iconBackground: 'bg-white/30',
32
+ iconConnector: 'bg-white',
33
+ },
34
+ };
35
+
36
+ const styleMaps = (version: BlockVersion): StyleType => STEPS_BLOCK_STYLE_MAPS[version];
37
+
10
38
  export const StepsBlock = JSX<StepsBlockProps>(
11
- ({ className, title, description, steps, size = 'normal' }) => {
39
+ ({ className, title, description, steps, size = 'normal', version = 'primary' }) => {
40
+ const style = styleMaps(version);
12
41
  return (
13
42
  <section
14
- className={`box-border font-sans text-primary-text bg-white px-4 py-6 flex flex-col ${
15
- className || ''
16
- }`}
43
+ className={`box-border font-sans bg-white px-4 py-6 flex flex-col
44
+ ${style.background} ${style.title} ${className || ''}`}
17
45
  >
18
- {title && <Heading headingType="h3" className="text-center" title={title} />}
19
- {description && <p className={`text-m-md text-center ${title && 'mt-2'}`}>{description}</p>}
46
+ {title && (
47
+ <Heading headingType="h3" className={`text-center ${style.title}`} title={title} />
48
+ )}
49
+ {description && (
50
+ <p className={`text-m-md text-center ${style.description} ${title && 'mt-2'}`}>
51
+ {description}
52
+ </p>
53
+ )}
20
54
  {steps?.length ? (
21
55
  <div className={`box-border py-0.5 mb-0.5 mt-5`}>
22
56
  <div className="flex flex-col justify-between gap-x-[101px]">
23
- {steps.map((step, i) => renderStepTitle({ step, size, i, length: steps.length }))}
57
+ {steps.map((step, i) =>
58
+ renderStepTitle({ step, size, i, length: steps.length, version: version }),
59
+ )}
24
60
  </div>
25
61
  </div>
26
62
  ) : null}
@@ -34,20 +70,23 @@ interface RenderStepTitleParams {
34
70
  size: SizeVersion;
35
71
  i: number;
36
72
  length: number;
73
+ version: BlockVersion;
37
74
  }
38
75
 
39
76
  const renderStepTitle = (params: RenderStepTitleParams) => {
40
- const { step, size, i, length } = params;
41
-
77
+ const { step, size, i, length, version } = params;
42
78
  const isLastStep = length - 1 === i;
43
79
  const margin = size === 'normal' ? 'ml-[34px]' : 'ml-[24px]';
80
+ const style = styleMaps(version);
44
81
 
45
82
  return (
46
83
  <div key={String(i)}>
47
84
  <div key={String(i)} className="flex flex-row text-center relative">
48
- <div>
49
- {renderIconArea(step, size, i)}
50
- {!isLastStep && <div className={`min-h-8 h-full w-[2px] bg-secondary-light ${margin}`} />}
85
+ <div className="overflow-hidden">
86
+ {renderIconArea(params)}
87
+ {!isLastStep && (
88
+ <div className={`min-h-8 h-full w-[2px] ${style.iconConnector} ${margin}`} />
89
+ )}
51
90
  </div>
52
91
  <div className="flex flex-col justify-start relative">
53
92
  {step.label && (
@@ -55,7 +94,7 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
55
94
  )}
56
95
  {step.description && (
57
96
  <div
58
- className={`font-normal text-sm text-secondary-text text-left ${
97
+ className={`font-normal text-sm ${style.description} text-left ${
59
98
  step.label ? 'mt-1' : ''
60
99
  }`}
61
100
  >
@@ -68,7 +107,9 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
68
107
  );
69
108
  };
70
109
 
71
- const renderIconArea = (step: Step, size: SizeVersion, i: number) => {
110
+ const renderIconArea = (params: RenderStepTitleParams) => {
111
+ const { step, size, i, version } = params;
112
+ const style = styleMaps(version);
72
113
  const iconAreaSize =
73
114
  size === 'normal'
74
115
  ? 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]'
@@ -79,10 +120,10 @@ const renderIconArea = (step: Step, size: SizeVersion, i: number) => {
79
120
 
80
121
  return (
81
122
  <div
82
- className={`${iconAreaSize} bg-secondary-light rounded-full z-10 mr-3 flex justify-center content-center`}
123
+ className={`${iconAreaSize} ${style.iconBackground} rounded-full z-10 mr-3 flex justify-center content-center`}
83
124
  >
84
- <span className={`font-medium text-secondary-text self-center ${iconTextSize}`}>
85
- {(step.icon && <Icon name={step.icon} width={iconSize} height={iconSize} />) || i + 1}
125
+ <span className={`font-medium flex self-center ${style.title} ${iconTextSize}`}>
126
+ {(step.icon && <Icon name={step.icon} width={iconSize} height={iconSize} asSVG />) || i + 1}
86
127
  </span>
87
128
  </div>
88
129
  );
@@ -1,6 +1,6 @@
1
1
  import type { IconName } from '../../ui-kit/Icon/IconProps';
2
-
3
2
  import type { SizeVersion } from '../../model/SizeVersion';
3
+ import type { BlockVersion } from '../../model/BlockVersion';
4
4
 
5
5
  /**
6
6
  * @title Шаг
@@ -30,4 +30,5 @@ export interface StepsBlockContent {
30
30
  */
31
31
  steps?: Step[];
32
32
  size?: SizeVersion; // TODO: mobile content
33
+ version?: BlockVersion; // TODO: mobile content
33
34
  }
@@ -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.16",
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
  }
@@ -8,11 +8,11 @@ import { HorizontalNavigation } from './HorizontalNavigation';
8
8
  import { SocialMedia } from './SocialMedia';
9
9
  import { TextInformation } from './TextInformation';
10
10
 
11
+ import { useSitemap } from '../../services/sitemap/useSitemap';
11
12
  import { Button } from '../../ui-kit/Button/Button';
12
13
  import { Icon } from '../../ui-kit/Icon/Icon';
13
14
  import { SearchBar } from '../../ui-kit/SearchBar/SearchBar';
14
15
  import { getAccordionItems } from '../../utils/getAccordionItems';
15
- import { useSitemap } from "../../services/sitemap/useSitemap";
16
16
 
17
17
  export interface FooterProps extends FooterContent, UniBlockProps {}
18
18
 
@@ -27,7 +27,7 @@ export const Footer = JSX<FooterProps>(
27
27
  horizontalNavigationTitle,
28
28
  }) => {
29
29
  const sitemap = useSitemap(context.useAsyncData);
30
- const dispositions = sitemap?.dispositions
30
+ const dispositions = sitemap?.dispositions;
31
31
  return (
32
32
  <footer className={`px-4 py-[26px] bg-white ${className}`}>
33
33
  <Contacts className="overflow-hidden" items={contacts} context={context} hasButton />
@@ -2,5 +2,5 @@
2
2
  "title": "Заголовок",
3
3
  "description": "Описание",
4
4
  "align": "center",
5
- "bgColor": "transparent"
5
+ "bgColorHeadline": "transparent"
6
6
  }