@redneckz/wildless-cms-uni-blocks 0.2.88 → 0.2.92

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 (155) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +63 -26
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/BaseTile/BaseTile.js +1 -3
  5. package/dist/components/BaseTile/BaseTile.js.map +1 -1
  6. package/dist/components/BlockContent.d.ts +2 -1
  7. package/dist/components/Blocks.d.ts +1 -0
  8. package/dist/components/Blocks.js +2 -0
  9. package/dist/components/Blocks.js.map +1 -1
  10. package/dist/components/ComparisonTable/ComparisonTable.js +3 -6
  11. package/dist/components/ComparisonTable/ComparisonTable.js.map +1 -1
  12. package/dist/components/ComparisonTable/ComparisonTableContent.d.ts +0 -20
  13. package/dist/components/ComparisonTable/TableCarouselContainer.d.ts +3 -0
  14. package/dist/components/ComparisonTable/TableCarouselContainer.js +5 -2
  15. package/dist/components/ComparisonTable/TableCarouselContainer.js.map +1 -1
  16. package/dist/components/ComparisonTable/TableRow.js +1 -1
  17. package/dist/components/ComparisonTable/TableRow.js.map +1 -1
  18. package/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -3
  19. package/dist/components/PictureText/PictureText.js +1 -1
  20. package/dist/components/PictureText/PictureText.js.map +1 -1
  21. package/dist/components/PictureText/PictureTextContent.d.ts +1 -1
  22. package/dist/components/TariffsTable/TariffsTable.d.ts +5 -0
  23. package/dist/components/TariffsTable/TariffsTable.js +20 -0
  24. package/dist/components/TariffsTable/TariffsTable.js.map +1 -0
  25. package/dist/components/TariffsTable/TariffsTableCell.d.ts +6 -0
  26. package/dist/components/TariffsTable/TariffsTableCell.js +18 -0
  27. package/dist/components/TariffsTable/TariffsTableCell.js.map +1 -0
  28. package/dist/components/TariffsTable/TariffsTableContent.d.ts +55 -0
  29. package/dist/components/TariffsTable/TariffsTableContent.js +2 -0
  30. package/dist/components/TariffsTable/TariffsTableContent.js.map +1 -0
  31. package/dist/components/TariffsTable/TariffsTableRow.d.ts +8 -0
  32. package/dist/components/TariffsTable/TariffsTableRow.js +13 -0
  33. package/dist/components/TariffsTable/TariffsTableRow.js.map +1 -0
  34. package/dist/components/TariffsTable/constants.d.ts +4 -0
  35. package/dist/components/TariffsTable/constants.js +7 -0
  36. package/dist/components/TariffsTable/constants.js.map +1 -0
  37. package/dist/components/TextBlock/TextBlock.d.ts +1 -1
  38. package/dist/components/TextBlock/TextBlock.js +1 -1
  39. package/dist/components/TextBlock/TextBlock.js.map +1 -1
  40. package/dist/hooks/useComparisonTableScroll.d.ts +7 -0
  41. package/dist/hooks/useComparisonTableScroll.js +12 -0
  42. package/dist/hooks/useComparisonTableScroll.js.map +1 -0
  43. package/dist/model/TableVersion.d.ts +1 -0
  44. package/dist/model/TableVersion.js +2 -0
  45. package/dist/model/TableVersion.js.map +1 -0
  46. package/dist/ui-kit/BlockItem/BlockItem.d.ts +1 -9
  47. package/dist/ui-kit/BlockItem/BlockItem.js +5 -5
  48. package/dist/ui-kit/BlockItem/BlockItem.js.map +1 -1
  49. package/dist/ui-kit/BlockItem/BlockItemProps.d.ts +20 -0
  50. package/dist/ui-kit/BlockItem/BlockItemProps.js +2 -0
  51. package/dist/ui-kit/BlockItem/BlockItemProps.js.map +1 -0
  52. package/dist/ui-kit/Button/ButtonProps.d.ts +2 -1
  53. package/dist/ui-kit/Icon/IconProps.d.ts +58 -26
  54. package/dist/ui-kit/Icon/IconProps.js +39 -23
  55. package/dist/ui-kit/Icon/IconProps.js.map +1 -1
  56. package/lib/common.css +1 -1
  57. package/lib/components/BaseTile/BaseTile.js +1 -3
  58. package/lib/components/BaseTile/BaseTile.js.map +1 -1
  59. package/lib/components/BlockContent.d.ts +2 -1
  60. package/lib/components/Blocks.d.ts +1 -0
  61. package/lib/components/Blocks.js +2 -0
  62. package/lib/components/Blocks.js.map +1 -1
  63. package/lib/components/ComparisonTable/ComparisonTable.js +4 -7
  64. package/lib/components/ComparisonTable/ComparisonTable.js.map +1 -1
  65. package/lib/components/ComparisonTable/ComparisonTableContent.d.ts +0 -20
  66. package/lib/components/ComparisonTable/TableCarouselContainer.d.ts +3 -0
  67. package/lib/components/ComparisonTable/TableCarouselContainer.js +5 -2
  68. package/lib/components/ComparisonTable/TableCarouselContainer.js.map +1 -1
  69. package/lib/components/ComparisonTable/TableRow.js +2 -2
  70. package/lib/components/ComparisonTable/TableRow.js.map +1 -1
  71. package/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -3
  72. package/lib/components/PictureText/PictureText.js +1 -1
  73. package/lib/components/PictureText/PictureText.js.map +1 -1
  74. package/lib/components/PictureText/PictureTextContent.d.ts +1 -1
  75. package/lib/components/TariffsTable/TariffsTable.d.ts +5 -0
  76. package/lib/components/TariffsTable/TariffsTable.fixture.d.ts +7 -0
  77. package/lib/components/TariffsTable/TariffsTable.js +18 -0
  78. package/lib/components/TariffsTable/TariffsTable.js.map +1 -0
  79. package/lib/components/TariffsTable/TariffsTableCell.d.ts +6 -0
  80. package/lib/components/TariffsTable/TariffsTableCell.js +16 -0
  81. package/lib/components/TariffsTable/TariffsTableCell.js.map +1 -0
  82. package/lib/components/TariffsTable/TariffsTableContent.d.ts +55 -0
  83. package/lib/components/TariffsTable/TariffsTableContent.js +2 -0
  84. package/lib/components/TariffsTable/TariffsTableContent.js.map +1 -0
  85. package/lib/components/TariffsTable/TariffsTableRow.d.ts +8 -0
  86. package/lib/components/TariffsTable/TariffsTableRow.js +11 -0
  87. package/lib/components/TariffsTable/TariffsTableRow.js.map +1 -0
  88. package/lib/components/TariffsTable/constants.d.ts +4 -0
  89. package/lib/components/TariffsTable/constants.js +5 -0
  90. package/lib/components/TariffsTable/constants.js.map +1 -0
  91. package/lib/components/TextBlock/TextBlock.d.ts +1 -1
  92. package/lib/components/TextBlock/TextBlock.js +1 -1
  93. package/lib/components/TextBlock/TextBlock.js.map +1 -1
  94. package/lib/hooks/useComparisonTableScroll.d.ts +7 -0
  95. package/lib/hooks/useComparisonTableScroll.js +9 -0
  96. package/lib/hooks/useComparisonTableScroll.js.map +1 -0
  97. package/lib/model/TableVersion.d.ts +1 -0
  98. package/lib/model/TableVersion.js +2 -0
  99. package/lib/model/TableVersion.js.map +1 -0
  100. package/lib/ui-kit/BlockItem/BlockItem.d.ts +1 -9
  101. package/lib/ui-kit/BlockItem/BlockItem.fixture.d.ts +6 -1
  102. package/lib/ui-kit/BlockItem/BlockItem.js +5 -5
  103. package/lib/ui-kit/BlockItem/BlockItem.js.map +1 -1
  104. package/lib/ui-kit/BlockItem/BlockItemProps.d.ts +20 -0
  105. package/lib/ui-kit/BlockItem/BlockItemProps.js +2 -0
  106. package/lib/ui-kit/BlockItem/BlockItemProps.js.map +1 -0
  107. package/lib/ui-kit/Button/ButtonProps.d.ts +2 -1
  108. package/lib/ui-kit/Icon/IconProps.d.ts +58 -26
  109. package/lib/ui-kit/Icon/IconProps.js +39 -23
  110. package/lib/ui-kit/Icon/IconProps.js.map +1 -1
  111. package/package.json +1 -1
  112. package/src/Icons/CalendarCircleIcon.svg +14 -0
  113. package/src/Icons/CardIcon.svg +11 -0
  114. package/src/Icons/CardPosIcon.svg +12 -0
  115. package/src/Icons/CardTickIcon.svg +13 -0
  116. package/src/Icons/EmptyWalletChangeIcon.svg +21 -0
  117. package/src/Icons/JCBIcon.svg +42 -0
  118. package/src/Icons/MastercardIcon.svg +6 -0
  119. package/src/Icons/MinusIcon.svg +1 -0
  120. package/src/Icons/MirIcon.svg +13 -0
  121. package/src/Icons/MoneyIcon.svg +13 -0
  122. package/src/Icons/MonitorMobileIcon.svg +14 -0
  123. package/src/Icons/PlusIcon.svg +1 -0
  124. package/src/Icons/Profile2UserIcon.svg +14 -0
  125. package/src/Icons/ShieldTickIcon.svg +7 -0
  126. package/src/Icons/UnionPayIcon.svg +7 -0
  127. package/src/Icons/UserIcon.svg +11 -0
  128. package/src/Icons/VisaIcon.svg +7 -0
  129. package/src/Icons/WalletIcon.svg +19 -0
  130. package/src/components/BaseTile/BaseTile.tsx +5 -10
  131. package/src/components/BlockContent.ts +2 -0
  132. package/src/components/Blocks.ts +2 -0
  133. package/src/components/ComparisonTable/ComparisonTable.tsx +14 -11
  134. package/src/components/ComparisonTable/ComparisonTableContent.ts +0 -21
  135. package/src/components/ComparisonTable/TableCarouselContainer.tsx +11 -4
  136. package/src/components/ComparisonTable/TableRow.tsx +2 -2
  137. package/src/components/ContentPage/ContentPage.page.json +415 -0
  138. package/src/components/MobileAppTile/MobileAppTileContent.ts +1 -3
  139. package/src/components/PictureText/PictureText.tsx +3 -1
  140. package/src/components/PictureText/PictureTextContent.ts +1 -2
  141. package/src/components/TariffsTable/TariffsTable.example.json +85 -0
  142. package/src/components/TariffsTable/TariffsTable.fixture.tsx +192 -0
  143. package/src/components/TariffsTable/TariffsTable.tsx +72 -0
  144. package/src/components/TariffsTable/TariffsTableCell.tsx +64 -0
  145. package/src/components/TariffsTable/TariffsTableContent.ts +61 -0
  146. package/src/components/TariffsTable/TariffsTableRow.tsx +46 -0
  147. package/src/components/TariffsTable/constants.ts +4 -0
  148. package/src/components/TextBlock/TextBlock.tsx +2 -2
  149. package/src/hooks/useComparisonTableScroll.ts +16 -0
  150. package/src/model/TableVersion.ts +1 -0
  151. package/src/ui-kit/BlockItem/BlockItem.fixture.tsx +8 -1
  152. package/src/ui-kit/BlockItem/BlockItem.tsx +7 -18
  153. package/src/ui-kit/BlockItem/BlockItemProps.ts +22 -0
  154. package/src/ui-kit/Button/ButtonProps.ts +2 -1
  155. package/src/ui-kit/Icon/IconProps.ts +35 -3
@@ -35,7 +35,9 @@ function renderBenefit(benefit: Benefit, i: number) {
35
35
  />
36
36
  )}
37
37
  <div className="flex gap-1 flex-col h-full ml-5 max-w-[490px]">
38
- <div className="font-medium text-primary-text text-xl m-0">{benefit.label}</div>
38
+ {benefit.label && (
39
+ <div className="font-medium text-primary-text text-xl m-0">{benefit.label}</div>
40
+ )}
39
41
  {benefit.description && (
40
42
  <div className="font-normal text-sm text-secondary-text">{benefit.description}</div>
41
43
  )}
@@ -4,8 +4,7 @@ import type { Benefit } from '../BenefitsBlock/BenefitsBlockContent';
4
4
  /**
5
5
  * @title Картинка с текстом
6
6
  */
7
- export interface PictureTextContent
8
- extends Pick<BaseTileCommonProps, 'title' | 'description' | 'image'> {
7
+ export interface PictureTextContent extends Pick<BaseTileCommonProps, 'title' | 'image'> {
9
8
  /**
10
9
  * @title Список преимуществ
11
10
  */
@@ -0,0 +1,85 @@
1
+ {
2
+ "title": "Заголовок",
3
+ "rowHeaders": [
4
+ {
5
+ "title": "Параметр 1",
6
+ "icon": "MoneyIcon"
7
+ },
8
+ {
9
+ "title": "Параметр 2",
10
+ "icon": "DollarIcon"
11
+ },
12
+ {
13
+ "title": "Параметр 3"
14
+ },
15
+ {
16
+ "title": "Параметр 4"
17
+ }
18
+ ],
19
+ "columns": [
20
+ {
21
+ "data": [
22
+ [
23
+ {
24
+ "label": "Ячейка 1"
25
+ }
26
+ ],
27
+ [
28
+ {
29
+ "label": "Ячейка 2-1",
30
+ "description": "Описание для ячейки 2-1"
31
+ },
32
+ {
33
+ "label": "Ячейка 2-2",
34
+ "description": "Описание для ячейки 2-2"
35
+ }
36
+ ],
37
+ [
38
+ {
39
+ "label": "Ячейка 3-1",
40
+ "description": "Описание для ячейки 3-1"
41
+ },
42
+ {
43
+ "label": "Ячейка 3-2",
44
+ "buttons": [
45
+ {
46
+ "icon": "AppleIcon",
47
+ "rounded": true,
48
+ "version": "secondary",
49
+ "href": "/_blank",
50
+ "target": "_blank"
51
+ },
52
+ {
53
+ "icon": "PlayMarketIcon",
54
+ "rounded": true,
55
+ "version": "secondary",
56
+ "href": "/secondary"
57
+ }
58
+ ]
59
+ }
60
+ ],
61
+ [
62
+ {
63
+ "image": {
64
+ "src": "payment-systems.png",
65
+ "format": "webp",
66
+ "size": {
67
+ "width": 288,
68
+ "height": 56
69
+ }
70
+ }
71
+ },
72
+ {
73
+ "list": {
74
+ "items": [
75
+ "item 1",
76
+ "item 2",
77
+ "item 3"
78
+ ]
79
+ }
80
+ }
81
+ ]
82
+ ]
83
+ }
84
+ ]
85
+ }
@@ -0,0 +1,192 @@
1
+ import { context } from '../../setup-fixture';
2
+ import { TariffsTable } from './TariffsTable';
3
+ import type { Picture } from '../../model/Picture';
4
+ import type { TariffsTableColumn, TariffsTableRowHeader } from './TariffsTableContent';
5
+
6
+ const image: Picture = {
7
+ src: 'payment-systems.png',
8
+ format: 'webp',
9
+ size: {
10
+ width: 288,
11
+ height: 56,
12
+ },
13
+ };
14
+
15
+ const rowHeaders: TariffsTableRowHeader[] = [
16
+ { title: 'Начисление процентов на остаток по счету', icon: 'OkIcon' },
17
+ { title: 'Снятие наличных', icon: 'GlassIcon' },
18
+ { title: 'Оформление онлайн', icon: 'ShieldTickIcon' },
19
+ { title: 'Кэшбэк баллами' },
20
+ { title: 'Стоимость обслуживания' },
21
+ { title: 'Стоимость SMS-сервиса' },
22
+ { title: 'Дополнительная информация' },
23
+ ];
24
+
25
+ const columns: TariffsTableColumn[] = [
26
+ {
27
+ data: [
28
+ [{ label: 'Нет' }],
29
+ [
30
+ {
31
+ label: 'Бесплатно',
32
+ description: 'В банкоматах и кассах Россельхозбанка и банков-партнеров',
33
+ },
34
+ {
35
+ label: 'Бесплатно',
36
+ description: 'В сторонних банкоматах - 1 раз в месяц, далее 1% минимум 150 руб',
37
+ },
38
+ ],
39
+ [{ label: 'Нет' }],
40
+ [{ label: 'Платёжные системы картинкой' }, { image: image }],
41
+ [
42
+ { label: 'Кнопки-иконки' },
43
+ {
44
+ buttons: [
45
+ {
46
+ icon: 'AppleIcon',
47
+ rounded: true,
48
+ version: 'secondary',
49
+ href: '/_blank',
50
+ target: '_blank',
51
+ },
52
+ {
53
+ icon: 'PlayMarketIcon',
54
+ rounded: true,
55
+ version: 'secondary',
56
+ href: '/secondary',
57
+ },
58
+ ],
59
+ },
60
+ ],
61
+ [
62
+ {
63
+ label: 'Бесплатно',
64
+ list: {
65
+ items: ['item 1', 'item 2', 'item 3'],
66
+ },
67
+ },
68
+ ],
69
+ [
70
+ {
71
+ image: {
72
+ src: 'money-1.png',
73
+ format: 'webp',
74
+ size: {
75
+ width: 140,
76
+ height: 140,
77
+ },
78
+ },
79
+ },
80
+ ],
81
+ ],
82
+ },
83
+ {
84
+ data: [
85
+ [{ label: 'Нет' }],
86
+ [
87
+ {
88
+ label: 'Бесплатно',
89
+ description: 'В банкоматах и кассах Россельхозбанка и банков-партнеров',
90
+ },
91
+ {
92
+ label: '1%',
93
+ description: 'В сторонних банкоматах, минимум 150 руб',
94
+ },
95
+ ],
96
+ [{ label: 'Нет' }],
97
+ [
98
+ { label: 'До 20%' },
99
+ {
100
+ list: {
101
+ isDotted: false,
102
+ items: ['item 1', 'item 2', 'item 3'],
103
+ },
104
+ },
105
+ ],
106
+ [
107
+ {
108
+ label: 'Бесплатно',
109
+ description: 'При обороте по карте от 10000 ₽ в месяц',
110
+ },
111
+ ],
112
+ [
113
+ { label: '69 рублей в месяц' },
114
+ {
115
+ list: {
116
+ version: 'primary',
117
+ items: ['item 1', 'item 2', 'item 3'],
118
+ },
119
+ },
120
+ ],
121
+ [
122
+ {
123
+ description:
124
+ 'Копите баллы каждый день и обменивайте их на скидки на электронику и бытовую технику Panasonic',
125
+ },
126
+ ],
127
+ ],
128
+ },
129
+ {
130
+ data: [
131
+ [{ label: 'Нет' }],
132
+ [{ label: 'Бесплатно' }],
133
+ [{ label: 'Есть' }],
134
+ [{ label: 'До 20%' }],
135
+ [
136
+ {
137
+ label: 'Бесплатно',
138
+ description: 'При обороте по карте от 10000 ₽ в месяц',
139
+ },
140
+ ],
141
+ [{ label: '69 рублей в месяц' }],
142
+ [{ description: 'Для членов профсоюзных организаций' }],
143
+ ],
144
+ },
145
+ ];
146
+
147
+ export default {
148
+ default: (
149
+ <div className="w-[1280px]">
150
+ <TariffsTable
151
+ className="col-span-12"
152
+ title="Другие дебетовые карты Россельхозбанка"
153
+ context={context}
154
+ rowHeaders={rowHeaders}
155
+ columns={Array(2).fill(columns).flat()}
156
+ />
157
+ </div>
158
+ ),
159
+ '1 column': (
160
+ <div className="w-[1280px]">
161
+ <TariffsTable
162
+ className="col-span-12"
163
+ title="Другие дебетовые карты Россельхозбанка"
164
+ context={context}
165
+ rowHeaders={rowHeaders}
166
+ columns={columns.slice(0, 1)}
167
+ />
168
+ </div>
169
+ ),
170
+ '2 columns': (
171
+ <div className="w-[1280px]">
172
+ <TariffsTable
173
+ className="col-span-12"
174
+ title="Другие дебетовые карты Россельхозбанка"
175
+ context={context}
176
+ rowHeaders={rowHeaders}
177
+ columns={columns.slice(0, 2)}
178
+ />
179
+ </div>
180
+ ),
181
+ '3 columns': (
182
+ <div className="w-[1280px]">
183
+ <TariffsTable
184
+ className="col-span-12"
185
+ title="Другие дебетовые карты Россельхозбанка"
186
+ context={context}
187
+ rowHeaders={rowHeaders}
188
+ columns={columns.slice(0, 3)}
189
+ />
190
+ </div>
191
+ ),
192
+ };
@@ -0,0 +1,72 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { ArrowButton } from '../../ui-kit/Button/ArrowButton';
3
+ import { Title } from '../../ui-kit/Title/Title';
4
+ import { COLS_LENGTH_FOR_SCROLL } from './constants';
5
+ import { TariffsTableRow } from './TariffsTableRow';
6
+ import type { UniBlockProps } from '../../types';
7
+ import type { TariffsTableContent } from './TariffsTableContent';
8
+ import { useComparisonTableScroll } from '../../hooks/useComparisonTableScroll';
9
+
10
+ export interface TariffsTableProps extends TariffsTableContent, UniBlockProps {}
11
+
12
+ export const TariffsTable = JSX<TariffsTableProps>(
13
+ ({ className, context, title, rowHeaders, columns }) => {
14
+ const [activeCardIndex, setActiveCardIndex] = context.useState(0);
15
+
16
+ const colData = columns?.map(({ data }) => data) || [];
17
+ const rowData = rowHeaders?.map((header, i) => ({
18
+ header,
19
+ data: colData.map((col) => col?.[i] || [{}]),
20
+ }));
21
+
22
+ const { nextClick, prevClick, isScrollAvailable, showNextButton, showPrevButton } =
23
+ useComparisonTableScroll(
24
+ colData,
25
+ COLS_LENGTH_FOR_SCROLL,
26
+ activeCardIndex,
27
+ setActiveCardIndex,
28
+ );
29
+
30
+ return (
31
+ <section
32
+ className={`bg-white font-sans py-[50px] pl-[50px] overflow-hidden text-primary-text relative ${
33
+ className || ''
34
+ }`}
35
+ >
36
+ <Title className="font-medium m-0 max-w-[47rem] text-center mb-9 mx-auto">{title}</Title>
37
+ {rowData?.length ? (
38
+ <div className="relative">
39
+ {rowData.map((row, i, { length }) => (
40
+ <TariffsTableRow
41
+ key={String(i)}
42
+ row={row}
43
+ isLastRow={i + 1 === length}
44
+ activeCardIndex={activeCardIndex}
45
+ />
46
+ ))}
47
+ {isScrollAvailable ? (
48
+ <div>
49
+ <div className="absolute top-7 right-7 z-10">
50
+ <ArrowButton
51
+ onClick={nextClick}
52
+ disabled={!showNextButton}
53
+ ariaLabel="Пролистать вправо"
54
+ />
55
+ <ArrowButton
56
+ className="mt-4 rotate-180"
57
+ onClick={prevClick}
58
+ disabled={!showPrevButton}
59
+ ariaLabel="Пролистать влево"
60
+ />
61
+ </div>
62
+ </div>
63
+ ) : null}
64
+ </div>
65
+ ) : null}
66
+ {isScrollAvailable ? (
67
+ <div className="absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" />
68
+ ) : null}
69
+ </section>
70
+ );
71
+ },
72
+ );
@@ -0,0 +1,64 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { DIVIDER_CLASSES } from './constants';
3
+ import { BlockItem } from '../../ui-kit/BlockItem/BlockItem';
4
+ import { Img } from '../../ui-kit/Img';
5
+ import { Button } from '../../ui-kit/Button/Button';
6
+ import type { TariffsTableCellData } from './TariffsTableContent';
7
+ import { Icon } from '../../ui-kit/Icon/Icon';
8
+
9
+ export interface TariffsTableCellProps {
10
+ cell: TariffsTableCellData[];
11
+ isLastRow: boolean;
12
+ }
13
+
14
+ export const TariffsTableCell = JSX<TariffsTableCellProps>(({ cell, isLastRow }) => {
15
+ const cellWrapperClasses = `first:pl-0 pl-10 w-80 flex-grow flex flex-col border-solid border-main-divider border border-t-0 border-x-0 ${
16
+ isLastRow ? 'border-t-0 rounded-b-md' : ''
17
+ }`;
18
+
19
+ const cellClasses = `h-full ${DIVIDER_CLASSES}`;
20
+
21
+ return (
22
+ <div className={cellWrapperClasses}>
23
+ <div className={cellClasses}>{cell.map((item, i) => renderCellInner(item, i))}</div>
24
+ </div>
25
+ );
26
+ });
27
+
28
+ const renderCellInner = (
29
+ { label, description, list, image, buttons }: TariffsTableCellData,
30
+ i: number,
31
+ ) => (
32
+ <div className="first:pt-5 last:pb-5">
33
+ {i > 0 && (
34
+ <div className="border-main-divider border border-solid border-t-0 border-x-0 my-4" />
35
+ )}
36
+ {label && <h5 className="text-xl font-medium m-0">{label}</h5>}
37
+ {description && <div className="text-sm text-secondary-text">{description}</div>}
38
+ {list?.items?.length ? (
39
+ <div className="flex flex-col justify-between items-start">
40
+ <div>
41
+ {list.items.map((text, idx) => (
42
+ <BlockItem
43
+ key={String(idx)}
44
+ text={text}
45
+ version={list.version ?? 'secondary'}
46
+ isDotted={list.isDotted ?? true}
47
+ />
48
+ ))}
49
+ </div>
50
+ </div>
51
+ ) : null}
52
+ {image && <Img image={image} />}
53
+ {buttons?.length
54
+ ? buttons.map(({ icon, ...buttonProps }, idx) => (
55
+ <Button
56
+ className={`${idx > 0 ? 'ml-3' : ''} w-12 h-12`}
57
+ key={String(idx)}
58
+ appendLeft={icon && <Icon name={icon} width="24px" height="24px" />}
59
+ {...buttonProps}
60
+ />
61
+ ))
62
+ : null}
63
+ </div>
64
+ );
@@ -0,0 +1,61 @@
1
+ import type { CellData, RowHeader } from '../ComparisonTable/ComparisonTableContent';
2
+ import type { IconName } from '../../ui-kit/Icon/IconProps';
3
+ import type { Picture } from '../../model/Picture';
4
+ import type { BlockItemVersion } from '../../ui-kit/BlockItem/BlockItemProps';
5
+ import type { BaseTileIconButton } from '../BaseTile/BaseTileProps';
6
+
7
+ /**
8
+ * @title Ряд
9
+ */
10
+ export type TariffsTableRowData = {
11
+ header: TariffsTableRowHeader;
12
+ data: TariffsTableCellData[][];
13
+ };
14
+
15
+ /**
16
+ * @title Колонка
17
+ */
18
+ export interface TariffsTableColumn {
19
+ /** @title Данные */
20
+ data?: TariffsTableCellData[][];
21
+ }
22
+
23
+ /**
24
+ * @title Список
25
+ */
26
+ export interface TariffsTableList {
27
+ version?: BlockItemVersion;
28
+ /** @title Маркеры */
29
+ isDotted?: boolean;
30
+ /** @title Элементы списка */
31
+ items?: string[];
32
+ }
33
+
34
+ /**
35
+ * @title Ячейка
36
+ */
37
+ export interface TariffsTableCellData extends CellData {
38
+ list?: TariffsTableList;
39
+ image?: Picture;
40
+ /** @title Кнопки */
41
+ buttons?: BaseTileIconButton[];
42
+ }
43
+
44
+ /**
45
+ * @title Параметр
46
+ */
47
+ export interface TariffsTableRowHeader extends RowHeader {
48
+ icon?: IconName;
49
+ }
50
+
51
+ /**
52
+ * @title Таблица тарифов
53
+ */
54
+ export interface TariffsTableContent {
55
+ /** @title Заголовок */
56
+ title?: string;
57
+ /** @title Колонки */
58
+ columns?: TariffsTableColumn[];
59
+ /** @title Параметры */
60
+ rowHeaders?: TariffsTableRowHeader[];
61
+ }
@@ -0,0 +1,46 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { COLUMN_WIDTH, DIVIDER_CLASSES, FIRST_CELL_CLASSES } from './constants';
3
+ import { Icon } from '../../ui-kit/Icon/Icon';
4
+ import { TariffsTableCell } from './TariffsTableCell';
5
+ import { TableRowContainer } from '../ComparisonTable/TableRowContainer';
6
+ import { TableCarouselContainer } from '../ComparisonTable/TableCarouselContainer';
7
+ import type { TariffsTableRowData } from './TariffsTableContent';
8
+
9
+ export interface TariffsTableRowProps {
10
+ className?: string;
11
+ row: TariffsTableRowData;
12
+ activeCardIndex: number;
13
+ isLastRow: boolean;
14
+ }
15
+
16
+ export const TariffsTableRow = JSX<TariffsTableRowProps>(
17
+ ({ row: { header, data }, activeCardIndex, isLastRow }) => {
18
+ return (
19
+ <TableRowContainer>
20
+ <div
21
+ className={`text-sm py-5 ${FIRST_CELL_CLASSES} ${DIVIDER_CLASSES} ${
22
+ !isLastRow ? 'border-solid' : ''
23
+ }`}
24
+ >
25
+ <div className="flex items-center text-primary-text">
26
+ {header?.icon && (
27
+ <Icon className="pr-[14px]" name={header.icon} width="24px" height="24px" />
28
+ )}
29
+ {header?.title}
30
+ </div>
31
+ </div>
32
+ {data?.length ? (
33
+ <TableCarouselContainer
34
+ activeCardIndex={activeCardIndex}
35
+ columnWidth={COLUMN_WIDTH}
36
+ version="tariff"
37
+ >
38
+ {data.map((cell, i) => (
39
+ <TariffsTableCell key={String(i)} cell={cell} isLastRow={isLastRow} />
40
+ ))}
41
+ </TableCarouselContainer>
42
+ ) : null}
43
+ </TableRowContainer>
44
+ );
45
+ },
46
+ );
@@ -0,0 +1,4 @@
1
+ export const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
2
+ export const FIRST_CELL_CLASSES = 'w-[354px] flex-shrink-0';
3
+ export const COLS_LENGTH_FOR_SCROLL = 2;
4
+ export const COLUMN_WIDTH = 4 * 80 + 40; // w-80 + pl-10 = 360px
@@ -1,8 +1,8 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { Picture } from '../../model/Picture';
3
- import type { TextBlockContent, TextBlockVersion } from './TextBlockContent';
4
3
  import type { UniBlockProps } from '../../types';
5
4
  import { Img } from '../../ui-kit/Img';
5
+ import type { TextBlockContent, TextBlockVersion } from './TextBlockContent';
6
6
 
7
7
  export interface TextBlockProps extends TextBlockContent, UniBlockProps {}
8
8
 
@@ -54,7 +54,7 @@ export const TextBlock = JSX<TextBlockProps>(
54
54
 
55
55
  function renderIcon(className: string) {
56
56
  return (
57
- <div className={`pt-1.5 pr-4`}>
57
+ <div className={`pt-1.5 pl-1 pr-4`}>
58
58
  <div className={`rounded-full h-4 w-4 text-center text-xs ${className}`}>i</div>
59
59
  </div>
60
60
  );
@@ -0,0 +1,16 @@
1
+ export const useComparisonTableScroll = <COL_DATA>(
2
+ colData: COL_DATA[],
3
+ colsLengthForScroll: number,
4
+ activeCardIndex: number,
5
+ setActiveCardIndex: (_: number) => void,
6
+ ) => {
7
+ const nextClick = () => setActiveCardIndex(activeCardIndex + 1);
8
+ const prevClick = () => setActiveCardIndex(activeCardIndex - 1);
9
+
10
+ const isScrollAvailable = colData?.length && colData.length > colsLengthForScroll;
11
+ const showNextButton =
12
+ isScrollAvailable && colData?.length - activeCardIndex > colsLengthForScroll;
13
+ const showPrevButton = isScrollAvailable && activeCardIndex > 0;
14
+
15
+ return { nextClick, prevClick, isScrollAvailable, showNextButton, showPrevButton };
16
+ };
@@ -0,0 +1 @@
1
+ export type TableVersion = 'comparison' | 'tariff';
@@ -2,4 +2,11 @@ import '../../setup-fixture';
2
2
 
3
3
  import { BlockItem } from './BlockItem';
4
4
 
5
- export default <BlockItem text="Совершайте любые личные покупки" />;
5
+ export default {
6
+ primary: <BlockItem text="Совершайте любые личные покупки" />,
7
+ 'primary without dot': <BlockItem text="Совершайте любые личные покупки" isDotted={false} />,
8
+ secondary: <BlockItem text="Совершайте любые личные покупки" version="secondary" />,
9
+ 'secondary without dot': (
10
+ <BlockItem text="Совершайте любые личные покупки" isDotted={false} version="secondary" />
11
+ ),
12
+ };
@@ -1,33 +1,22 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
-
3
- type BlockItemVersion = 'primary' | 'secondary';
4
- export interface BlockItemContent {
5
- text?: string;
6
- }
7
-
8
- export interface BlockItemProps extends BlockItemContent {
9
- className?: string;
10
- version?: BlockItemVersion;
11
- }
2
+ import { BlockItemProps, BlockItemVersion } from './BlockItemProps';
12
3
 
13
4
  const listStyleMap: Record<BlockItemVersion, string> = {
14
- primary: 'bg-primary-main',
15
- secondary: 'bg-white',
5
+ primary: 'bg-primary-main w-[8px] h-[8px] min-w-[8px] min-h-[8px] mt-2 rounded-full',
6
+ secondary: 'bg-secondary-text w-[6px] h-[6px] min-w-[6px] min-h-[6px] mt-2.5 rounded-full',
16
7
  };
17
8
 
18
9
  const textStyleMap: Record<BlockItemVersion, string> = {
19
10
  primary: 'text-primary-text',
20
- secondary: 'text-white',
11
+ secondary: 'text-secondary-text',
21
12
  };
22
13
 
23
14
  export const BlockItem = JSX<BlockItemProps>(
24
- ({ className, text, children, version = 'primary' }) => {
15
+ ({ className, isDotted = true, text, children, version = 'primary' }) => {
25
16
  return (
26
17
  <div className={`inline-block flex ${className || ''}`} role="listitem">
27
- <div
28
- className={`inline-block w-[8px] h-[8px] min-w-[8px] min-h-[8px] rounded-full mt-2 ${listStyleMap[version]}`}
29
- ></div>
30
- <span className={`text-base font-normal font-sans mx-3 ${textStyleMap[version]}`}>
18
+ {isDotted && <div className={`inline-block mr-3 ${listStyleMap[version]}`} />}
19
+ <span className={`text-base font-normal font-sans mr-3 ${textStyleMap[version]}`}>
31
20
  {text || children}
32
21
  </span>
33
22
  </div>
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @title Версия списка
3
+ */
4
+ export type BlockItemVersion = 'primary' | 'secondary';
5
+
6
+ /**
7
+ * @title Содержимое элемента блока
8
+ */
9
+ export interface BlockItemContent {
10
+ /** @title Текст */
11
+ text?: string;
12
+ }
13
+
14
+ /**
15
+ * @title Параметры элемента блока
16
+ */
17
+ export interface BlockItemProps extends BlockItemContent {
18
+ className?: string;
19
+ version?: BlockItemVersion;
20
+ /** @title Маркер */
21
+ isDotted?: boolean;
22
+ }
@@ -13,12 +13,13 @@ export interface ButtonAdditionalProps {
13
13
  }
14
14
 
15
15
  export interface ButtonProps extends ButtonAdditionalProps, LinkProps {
16
+ /** @title Текст */
16
17
  text?: string;
17
18
  version?: ButtonVersion;
18
19
  }
19
20
 
20
21
  export interface ButtonWithIconProps extends ButtonProps {
21
- /** @hidden */
22
+ /** @title Верхний текст */
22
23
  aboveText?: string;
23
24
  /** @hidden */
24
25
  appendLeft?: any;