@redneckz/wildless-cms-uni-blocks 0.2.58 → 0.2.59
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.
- package/dist/BaseTile.d.ts +4 -3
- package/dist/BaseTile.js +24 -11
- package/dist/BaseTile.js.map +1 -1
- package/dist/Blocks.d.ts +3 -1
- package/dist/Blocks.js +2 -0
- package/dist/Blocks.js.map +1 -1
- package/dist/Icons/AppleIcon.d.ts +1 -0
- package/dist/Icons/AppleIcon.js +6 -0
- package/dist/Icons/AppleIcon.js.map +1 -0
- package/dist/Icons/PlayMarket.d.ts +1 -0
- package/dist/Icons/PlayMarket.js +6 -0
- package/dist/Icons/PlayMarket.js.map +1 -0
- package/dist/Icons/index.d.ts +2 -0
- package/dist/Icons/index.js +5 -1
- package/dist/Icons/index.js.map +1 -1
- package/dist/MobileAppTile.d.ts +2 -1
- package/dist/MobileAppTile.js +2 -2
- package/dist/MobileAppTile.js.map +1 -1
- package/dist/ProductBlock.js +1 -1
- package/dist/ProductBlock.js.map +1 -1
- package/dist/ProductBlockInner.js +1 -1
- package/dist/ProductBlockInner.js.map +1 -1
- package/dist/ProductGallery.js +1 -1
- package/dist/ProductGallery.js.map +1 -1
- package/dist/ProductTile.js +3 -3
- package/dist/ProductTile.js.map +1 -1
- package/dist/PromoTile.d.ts +8 -0
- package/dist/PromoTile.js +18 -0
- package/dist/PromoTile.js.map +1 -0
- package/dist/Tile.js +14 -1
- package/dist/Tile.js.map +1 -1
- package/dist/api/DaDataAPI.js +2 -2
- package/dist/api/DaDataAPI.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui-kit/Button.d.ts +1 -3
- package/dist/ui-kit/Button.js +3 -3
- package/dist/ui-kit/Button.js.map +1 -1
- package/dist/ui-kit/IconButton.d.ts +6 -0
- package/dist/ui-kit/IconButton.js +11 -0
- package/dist/ui-kit/IconButton.js.map +1 -0
- package/dist/utils/getColSpan.d.ts +1 -0
- package/dist/utils/getColSpan.js +9 -0
- package/dist/utils/getColSpan.js.map +1 -0
- package/dist/utils/getGeolocation.d.ts +1 -0
- package/dist/utils/getGeolocation.js +5 -0
- package/dist/utils/getGeolocation.js.map +1 -0
- package/lib/BaseTile.d.ts +4 -3
- package/lib/BaseTile.js +24 -11
- package/lib/BaseTile.js.map +1 -1
- package/lib/Blocks.d.ts +3 -1
- package/lib/Blocks.js +2 -0
- package/lib/Blocks.js.map +1 -1
- package/lib/Icons/AppleIcon.d.ts +1 -0
- package/lib/Icons/AppleIcon.js +3 -0
- package/lib/Icons/AppleIcon.js.map +1 -0
- package/lib/Icons/PlayMarket.d.ts +1 -0
- package/lib/Icons/PlayMarket.js +3 -0
- package/lib/Icons/PlayMarket.js.map +1 -0
- package/lib/Icons/index.d.ts +2 -0
- package/lib/Icons/index.js +2 -0
- package/lib/Icons/index.js.map +1 -1
- package/lib/MobileAppTile.d.ts +2 -1
- package/lib/MobileAppTile.js +2 -2
- package/lib/MobileAppTile.js.map +1 -1
- package/lib/ProductBlock.js +1 -1
- package/lib/ProductBlock.js.map +1 -1
- package/lib/ProductBlockInner.js +1 -1
- package/lib/ProductBlockInner.js.map +1 -1
- package/lib/ProductGallery.js +1 -1
- package/lib/ProductGallery.js.map +1 -1
- package/lib/ProductTile.js +3 -3
- package/lib/ProductTile.js.map +1 -1
- package/lib/PromoTile.d.ts +8 -0
- package/lib/PromoTile.js +16 -0
- package/lib/PromoTile.js.map +1 -0
- package/lib/Tile.js +14 -1
- package/lib/Tile.js.map +1 -1
- package/lib/api/DaDataAPI.js +2 -2
- package/lib/api/DaDataAPI.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/types.d.ts +2 -0
- package/lib/ui-kit/Button.d.ts +1 -3
- package/lib/ui-kit/Button.js +3 -3
- package/lib/ui-kit/Button.js.map +1 -1
- package/lib/ui-kit/IconButton.d.ts +6 -0
- package/lib/ui-kit/IconButton.js +9 -0
- package/lib/ui-kit/IconButton.js.map +1 -0
- package/lib/utils/getColSpan.d.ts +1 -0
- package/lib/utils/getColSpan.js +6 -0
- package/lib/utils/getColSpan.js.map +1 -0
- package/lib/utils/getGeolocation.d.ts +1 -0
- package/lib/utils/getGeolocation.js +2 -0
- package/lib/utils/getGeolocation.js.map +1 -0
- package/package.json +1 -1
- package/src/BaseTile.tsx +34 -18
- package/src/Blocks.ts +3 -0
- package/src/ContentPage.fixture.tsx +1 -1
- package/src/ContentPage.page.json +35 -22
- package/src/Icons/AppleIcon.tsx +15 -0
- package/src/Icons/PlayMarket.tsx +8 -0
- package/src/Icons/index.ts +2 -0
- package/src/MobileAppTile.tsx +4 -3
- package/src/ProductBlock.tsx +3 -1
- package/src/ProductBlockInner.tsx +3 -3
- package/src/ProductGallery.tsx +7 -3
- package/src/ProductTile.tsx +3 -3
- package/src/PromoTile.tsx +47 -0
- package/src/Tile.tsx +18 -1
- package/src/api/DaDataAPI.ts +2 -2
- package/src/types.ts +2 -0
- package/src/ui-kit/Button.fixture.tsx +22 -0
- package/src/ui-kit/Button.tsx +12 -5
- package/src/ui-kit/IconButton.tsx +27 -0
- package/src/utils/getColSpan.ts +5 -0
- package/src/utils/{getCurrentPosition.ts → getGeolocation.ts} +1 -1
- package/dist/utils/getCurrentPosition.d.ts +0 -1
- package/dist/utils/getCurrentPosition.js +0 -5
- package/dist/utils/getCurrentPosition.js.map +0 -1
- package/lib/utils/getCurrentPosition.d.ts +0 -1
- package/lib/utils/getCurrentPosition.js +0 -2
- package/lib/utils/getCurrentPosition.js.map +0 -1
package/src/BaseTile.tsx
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { Img } from './Img';
|
|
3
|
-
import type { BlockVersion, Picture, UniBlockProps } from './types';
|
|
3
|
+
import type { BlockVersion, Picture, UniBlockProps, TitleSize } from './types';
|
|
4
4
|
import { BlockItem } from './ui-kit/BlockItem';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
5
|
+
import type { IconButtonProps } from './ui-kit/IconButton';
|
|
6
|
+
import { IconButton } from './ui-kit/IconButton';
|
|
7
7
|
import { useLink } from './useLink';
|
|
8
|
+
import { getColSpan } from './utils/getColSpan';
|
|
8
9
|
|
|
9
10
|
export interface BaseTileContent {
|
|
10
11
|
title?: string;
|
|
12
|
+
titleSize?: TitleSize;
|
|
11
13
|
description?: string;
|
|
12
14
|
image?: Picture;
|
|
13
15
|
items?: string[];
|
|
14
|
-
buttons?:
|
|
16
|
+
buttons?: IconButtonProps[];
|
|
15
17
|
version?: BlockVersion;
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -23,6 +25,7 @@ export const BaseTile = JSX<BaseTileProps>(
|
|
|
23
25
|
className,
|
|
24
26
|
context,
|
|
25
27
|
title,
|
|
28
|
+
titleSize,
|
|
26
29
|
description,
|
|
27
30
|
children,
|
|
28
31
|
buttons,
|
|
@@ -34,41 +37,54 @@ export const BaseTile = JSX<BaseTileProps>(
|
|
|
34
37
|
const { handlerDecorator } = context;
|
|
35
38
|
return (
|
|
36
39
|
<div className={`font-sans flex flex-col grow h-full`}>
|
|
37
|
-
{title && renderTitle(title, className)}
|
|
38
|
-
<div className="flex grow justify-between
|
|
40
|
+
{title && renderTitle(title, titleSize || getTitleSizeByClassName(className))}
|
|
41
|
+
<div className="flex grow justify-between">
|
|
39
42
|
<div className="flex flex-col justify-between items-start">
|
|
40
43
|
<div>
|
|
41
44
|
{description ? (
|
|
42
|
-
<div className="font-normal text-base max-w-[600px] mb-
|
|
45
|
+
<div className="font-normal text-base max-w-[600px] mb-5">{description}</div>
|
|
43
46
|
) : null}
|
|
44
47
|
{children}
|
|
45
48
|
{items?.length ? renderItems(items, version) : null}
|
|
46
49
|
</div>
|
|
47
50
|
{buttons?.length ? (
|
|
48
|
-
<div className="flex mt-
|
|
51
|
+
<div className="flex mt-9 gap-3">
|
|
49
52
|
{buttons.map((button, index) =>
|
|
50
53
|
renderButton(useLink({ router, handlerDecorator }, button), index),
|
|
51
54
|
)}
|
|
52
55
|
</div>
|
|
53
56
|
) : null}
|
|
54
57
|
</div>
|
|
55
|
-
{image?.src && <Img className="mt-auto" image={image} />}
|
|
58
|
+
{image?.src && <Img className="mt-auto ml-7" image={image} />}
|
|
56
59
|
</div>
|
|
57
60
|
</div>
|
|
58
61
|
);
|
|
59
62
|
},
|
|
60
63
|
);
|
|
61
64
|
|
|
62
|
-
function renderTitle(title: string,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
function renderTitle(title: string, titleSize: TitleSize) {
|
|
66
|
+
switch (titleSize) {
|
|
67
|
+
case 'XL':
|
|
68
|
+
return <h1 className={`${TITLE_CLASSES} text-title-lg`}>{title}</h1>;
|
|
69
|
+
case 'L':
|
|
70
|
+
return <h2 className={`${TITLE_CLASSES} text-title`}>{title}</h2>;
|
|
71
|
+
case 'M':
|
|
72
|
+
return <h2 className={`${TITLE_CLASSES} text-title-sm`}>{title}</h2>;
|
|
73
|
+
case 'S':
|
|
74
|
+
return <h2 className={`${TITLE_CLASSES} text-title-xs`}>{title}</h2>;
|
|
75
|
+
default:
|
|
76
|
+
return <h2 className={`${TITLE_CLASSES} text-title`}>{title}</h2>;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getTitleSizeByClassName(className: string = '') {
|
|
81
|
+
const colSpan = getColSpan(className);
|
|
66
82
|
if (colSpan <= 4) {
|
|
67
|
-
return
|
|
83
|
+
return 'S';
|
|
68
84
|
} else if (colSpan <= 8) {
|
|
69
|
-
return
|
|
85
|
+
return 'M';
|
|
70
86
|
} else {
|
|
71
|
-
return
|
|
87
|
+
return 'L';
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
|
|
@@ -82,6 +98,6 @@ function renderItems(items: string[] = [], version?: BlockVersion) {
|
|
|
82
98
|
);
|
|
83
99
|
}
|
|
84
100
|
|
|
85
|
-
function renderButton(button:
|
|
86
|
-
return button?.text ? <
|
|
101
|
+
function renderButton(button: IconButtonProps, i: number) {
|
|
102
|
+
return button?.text ? <IconButton key={String(i)} {...button} /> : null;
|
|
87
103
|
}
|
package/src/Blocks.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ProductGallery, ProductGalleryContent } from './ProductGallery';
|
|
|
10
10
|
import { StepsBlock, StepsBlockContent } from './StepsBlock';
|
|
11
11
|
import { ProductTile, ProductTileContent } from './ProductTile';
|
|
12
12
|
import { BaseTileContent } from './BaseTile';
|
|
13
|
+
import { PromoTile, PromoTileContent } from './PromoTile';
|
|
13
14
|
import { Tile } from './Tile';
|
|
14
15
|
|
|
15
16
|
export const Blocks = {
|
|
@@ -17,6 +18,7 @@ export const Blocks = {
|
|
|
17
18
|
Footer,
|
|
18
19
|
Placeholder,
|
|
19
20
|
Tile,
|
|
21
|
+
PromoTile,
|
|
20
22
|
ProductTile,
|
|
21
23
|
ProductBlock,
|
|
22
24
|
StepsBlock,
|
|
@@ -32,6 +34,7 @@ export type BlockContent =
|
|
|
32
34
|
| PlaceholderContent
|
|
33
35
|
| BaseTileContent
|
|
34
36
|
| ProductTileContent
|
|
37
|
+
| PromoTileContent
|
|
35
38
|
| ProductBlockInnerContent
|
|
36
39
|
| StepsBlockContent
|
|
37
40
|
| BenefitsBlockContent
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { context } from './setup-fixture';
|
|
2
2
|
|
|
3
3
|
import { Blocks } from './Blocks';
|
|
4
|
-
import { toMobilePage } from './content-page-repository/toMobilePage';
|
|
5
4
|
import { BlockDecorator, ContentPage } from './ContentPage';
|
|
6
5
|
import { MobileBlocks } from './MobileBlocks';
|
|
6
|
+
import { toMobilePage } from './toMobilePage';
|
|
7
7
|
import type { ContentPageDef } from './types';
|
|
8
8
|
|
|
9
9
|
const data = require('./ContentPage.page.json');
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
},
|
|
75
75
|
"productBlock": {
|
|
76
76
|
"title": "Ставка от 12,5% годовых на срок до 3 лет!»",
|
|
77
|
-
"description": "Кредит наличными без залога и поручительства. Потребительский кредит на любые цели. Нужен только паспорт.",
|
|
78
77
|
"items": [
|
|
79
78
|
"Потребительский кредит по специальной процентной ставке",
|
|
80
79
|
"Получите деньги без залога и поручительства",
|
|
@@ -107,11 +106,6 @@
|
|
|
107
106
|
"productBlock": {
|
|
108
107
|
"title": "Дополнительные бонусные баллы за покупки!»",
|
|
109
108
|
"description": "Кредит наличными без залога и поручительства. Потребительский кредит на любые цели. Нужен только паспорт.",
|
|
110
|
-
"items": [
|
|
111
|
-
"Потребительский кредит по специальной процентной ставке",
|
|
112
|
-
"Получите деньги без залога и поручительства",
|
|
113
|
-
"Кредитный лимит до 5 млн рублей"
|
|
114
|
-
],
|
|
115
109
|
"buttons": [
|
|
116
110
|
{
|
|
117
111
|
"href": "https://rshb.ru",
|
|
@@ -188,8 +182,8 @@
|
|
|
188
182
|
"title": "деньги",
|
|
189
183
|
"format": "webp",
|
|
190
184
|
"size": {
|
|
191
|
-
"width":
|
|
192
|
-
"height":
|
|
185
|
+
"width": 180,
|
|
186
|
+
"height": 180
|
|
193
187
|
}
|
|
194
188
|
}
|
|
195
189
|
},
|
|
@@ -203,6 +197,7 @@
|
|
|
203
197
|
"style": ["col-span-4"],
|
|
204
198
|
"content": {
|
|
205
199
|
"title": "Ипотека",
|
|
200
|
+
"titleSize": "M",
|
|
206
201
|
"description": "Широкий выбор ипотечных программ с государственной поддержкой. Специальный предложения от 12,2 %",
|
|
207
202
|
"buttons": [
|
|
208
203
|
{
|
|
@@ -235,8 +230,8 @@
|
|
|
235
230
|
"title": "Кредитка",
|
|
236
231
|
"format": "webp",
|
|
237
232
|
"size": {
|
|
238
|
-
"width":
|
|
239
|
-
"height":
|
|
233
|
+
"width": 180,
|
|
234
|
+
"height": 180
|
|
240
235
|
}
|
|
241
236
|
}
|
|
242
237
|
},
|
|
@@ -262,8 +257,8 @@
|
|
|
262
257
|
"alt": "Column",
|
|
263
258
|
"format": "webp",
|
|
264
259
|
"size": {
|
|
265
|
-
"width":
|
|
266
|
-
"height":
|
|
260
|
+
"width": 180,
|
|
261
|
+
"height": 180
|
|
267
262
|
}
|
|
268
263
|
}
|
|
269
264
|
},
|
|
@@ -294,8 +289,8 @@
|
|
|
294
289
|
"title": "Глобус",
|
|
295
290
|
"format": "webp",
|
|
296
291
|
"size": {
|
|
297
|
-
"width":
|
|
298
|
-
"height":
|
|
292
|
+
"width": 200,
|
|
293
|
+
"height": 200
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
}
|
|
@@ -359,11 +354,12 @@
|
|
|
359
354
|
}
|
|
360
355
|
},
|
|
361
356
|
{
|
|
362
|
-
"type": "
|
|
357
|
+
"type": "PromoTile",
|
|
363
358
|
"style": ["col-span-4"],
|
|
364
359
|
"content": {
|
|
365
360
|
"title": "Акции и спецпредложения",
|
|
366
361
|
"version": "secondary",
|
|
362
|
+
"date": "2022-04-16",
|
|
367
363
|
"description": "Пенсионный кредит по специальной процентной ставке",
|
|
368
364
|
"buttons": [
|
|
369
365
|
{
|
|
@@ -395,7 +391,23 @@
|
|
|
395
391
|
},
|
|
396
392
|
"mobile": {
|
|
397
393
|
"style": ["col-span-12"]
|
|
398
|
-
}
|
|
394
|
+
},
|
|
395
|
+
"buttons": [
|
|
396
|
+
{
|
|
397
|
+
"aboveText": "Загрузите в",
|
|
398
|
+
"text": "App Store",
|
|
399
|
+
"icon": "AppleIcon",
|
|
400
|
+
"href": "/credits",
|
|
401
|
+
"version": "secondary"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"aboveText": "Доступно в",
|
|
405
|
+
"text": "Google Play",
|
|
406
|
+
"icon": "PlayMarket",
|
|
407
|
+
"href": "/credits",
|
|
408
|
+
"version": "secondary"
|
|
409
|
+
}
|
|
410
|
+
]
|
|
399
411
|
},
|
|
400
412
|
{
|
|
401
413
|
"type": "Unknown",
|
|
@@ -497,8 +509,8 @@
|
|
|
497
509
|
"alt": "Кредиты в РСХБ",
|
|
498
510
|
"format": "webp",
|
|
499
511
|
"size": {
|
|
500
|
-
"width":
|
|
501
|
-
"height":
|
|
512
|
+
"width": 180,
|
|
513
|
+
"height": 180
|
|
502
514
|
}
|
|
503
515
|
}
|
|
504
516
|
},
|
|
@@ -539,8 +551,8 @@
|
|
|
539
551
|
"alt": "Пенсионный кредит в РСХБ",
|
|
540
552
|
"format": "webp",
|
|
541
553
|
"size": {
|
|
542
|
-
"width":
|
|
543
|
-
"height":
|
|
554
|
+
"width": 180,
|
|
555
|
+
"height": 180
|
|
544
556
|
}
|
|
545
557
|
}
|
|
546
558
|
},
|
|
@@ -581,8 +593,8 @@
|
|
|
581
593
|
"alt": "Кредит под залог недвижимости в РСХБ",
|
|
582
594
|
"format": "webp",
|
|
583
595
|
"size": {
|
|
584
|
-
"width":
|
|
585
|
-
"height":
|
|
596
|
+
"width": 180,
|
|
597
|
+
"height": 180
|
|
586
598
|
}
|
|
587
599
|
}
|
|
588
600
|
},
|
|
@@ -596,6 +608,7 @@
|
|
|
596
608
|
"version": "secondary",
|
|
597
609
|
"content": {
|
|
598
610
|
"title": "Кредит пенсионный",
|
|
611
|
+
"titleSize": "M",
|
|
599
612
|
"description": "Для людей в возрасте до 75 лет",
|
|
600
613
|
"benefits": [
|
|
601
614
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const AppleIcon = (props?: Record<string, any>) => (
|
|
2
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<g clip-path="url(#a)">
|
|
4
|
+
<path
|
|
5
|
+
d="M19.406 12.761c-.023-3.028 2.793-4.511 2.93-4.572-1.603-2.073-4.075-2.357-4.968-2.377-2.083-.204-4.098 1.117-5.174 1.117-1.076 0-2.725-1.097-4.488-1.056-2.266.04-4.395 1.198-5.563 3.007-2.404 3.698-.618 9.124 1.694 12.09 1.145 1.464 2.496 3.09 4.259 3.028 1.717-.06 2.358-.975 4.441-.975 2.06 0 2.656.975 4.465.935 1.854-.02 3.022-1.463 4.12-2.947 1.329-1.666 1.855-3.332 1.878-3.413 0 0-3.549-1.2-3.594-4.837Zm-3.389-8.92c.916-1.037 1.557-2.419 1.374-3.841-1.35.061-3.022.833-3.984 1.829-.847.894-1.625 2.337-1.42 3.698 1.512.102 3.069-.67 4.03-1.686Z"
|
|
6
|
+
fill="#42AB44"
|
|
7
|
+
/>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="a">
|
|
11
|
+
<rect width="24" height="24" rx="6" fill="#fff" />
|
|
12
|
+
</clipPath>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const PlayMarket = (props?: Record<string, any>) => (
|
|
2
|
+
<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path
|
|
4
|
+
d="M1 22.427V2.576C1 1.883 1.447 1.284 2.094 1L14.85 12.498 2.089 24a1.89 1.89 0 0 1-.795-.646A1.625 1.625 0 0 1 1 22.427Zm17.899-6.282-13.95 7.259 11.002-9.915 2.948 2.656Zm4.335-5.035c.237.162.428.37.561.61.133.239.203.502.205.77.002.267-.064.53-.193.771s-.317.452-.551.617l-2.964 1.542-3.241-2.922 3.24-2.92 2.944 1.532ZM4.959 1.598l13.938 7.253-2.945 2.654L4.958 1.598Z"
|
|
5
|
+
fill="#42AB44"
|
|
6
|
+
/>
|
|
7
|
+
</svg>
|
|
8
|
+
);
|
package/src/Icons/index.ts
CHANGED
|
@@ -15,3 +15,5 @@ export { ProfileIcon } from './ProfileIcon';
|
|
|
15
15
|
export { SignDocsIcon } from './SignDocsIcon';
|
|
16
16
|
export { TelegramIcon } from './TelegramIcon';
|
|
17
17
|
export { VKIcon } from './VKIcon';
|
|
18
|
+
export { AppleIcon } from './AppleIcon';
|
|
19
|
+
export { PlayMarket } from './PlayMarket';
|
package/src/MobileAppTile.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { Tile } from './Tile';
|
|
3
|
+
import type { BaseTileContent } from './BaseTile';
|
|
3
4
|
import type { UniBlockProps } from './types';
|
|
4
5
|
|
|
5
6
|
export interface QRCode {
|
|
@@ -7,7 +8,7 @@ export interface QRCode {
|
|
|
7
8
|
href?: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export interface MobileAppTileContent {
|
|
11
|
+
export interface MobileAppTileContent extends BaseTileContent {
|
|
11
12
|
title?: string;
|
|
12
13
|
qr?: QRCode;
|
|
13
14
|
}
|
|
@@ -15,9 +16,9 @@ export interface MobileAppTileContent {
|
|
|
15
16
|
export interface MobileAppTileProps extends MobileAppTileContent, UniBlockProps {}
|
|
16
17
|
|
|
17
18
|
export const MobileAppTile = JSX<MobileAppTileProps>(
|
|
18
|
-
({ className, context, title = 'Мобильное приложение', qr }) => {
|
|
19
|
+
({ className, context, title = 'Мобильное приложение', qr, buttons = [] }) => {
|
|
19
20
|
return (
|
|
20
|
-
<Tile className={className} context={context} title={title}>
|
|
21
|
+
<Tile className={className} context={context} title={title} buttons={buttons}>
|
|
21
22
|
<div className="flex items-center">
|
|
22
23
|
{qr?.src && qr?.href && (
|
|
23
24
|
<a href={qr.href} target="_blank">
|
package/src/ProductBlock.tsx
CHANGED
|
@@ -15,7 +15,9 @@ export const ProductBlock = JSX<ProductBlockProps>((props) => {
|
|
|
15
15
|
const router = context.useRouter();
|
|
16
16
|
const { handlerDecorator } = context;
|
|
17
17
|
return (
|
|
18
|
-
<section
|
|
18
|
+
<section
|
|
19
|
+
className={`font-sans bg-white pt-10 pl-[50px] pb-[50px] pr-[7.5rem] ${className || ''}`}
|
|
20
|
+
>
|
|
19
21
|
{breadcrumbs?.length ? (
|
|
20
22
|
<div className="text-xs mb-6">
|
|
21
23
|
{joinList(<span className="text-secondary-text mx-2">/</span>)(
|
|
@@ -16,16 +16,16 @@ export interface ProductBlockInnerProps extends ProductBlockInnerContent, UniBlo
|
|
|
16
16
|
export const ProductBlockInner = JSX<ProductBlockInnerProps>(
|
|
17
17
|
({ className, context, title, description, benefits, buttons, image, items }) => {
|
|
18
18
|
return (
|
|
19
|
-
<div className={`flex justify-between items-stretch ${className || ''}`}>
|
|
19
|
+
<div className={`flex grow justify-between items-stretch ${className || ''}`}>
|
|
20
20
|
<div className={'flex flex-col'}>
|
|
21
21
|
{title && (
|
|
22
|
-
<h1 className="font-medium text-title-lg m-0 whitespace-pre-wrap max-w-[600px]">
|
|
22
|
+
<h1 className="font-medium text-title-lg m-0 mb-4 whitespace-pre-wrap max-w-[600px]">
|
|
23
23
|
{title}
|
|
24
24
|
</h1>
|
|
25
25
|
)}
|
|
26
26
|
<BaseTile context={context} description={description} items={items} buttons={buttons}>
|
|
27
27
|
{benefits?.length ? (
|
|
28
|
-
<div className="flex gap-6 mt-6 mb-
|
|
28
|
+
<div className="flex gap-6 mt-6 mb-3.5">{benefits.map(renderBenefit)}</div>
|
|
29
29
|
) : null}
|
|
30
30
|
</BaseTile>
|
|
31
31
|
</div>
|
package/src/ProductGallery.tsx
CHANGED
|
@@ -54,9 +54,13 @@ export const ProductGallery = JSX<ProductGalleryProps>(
|
|
|
54
54
|
|
|
55
55
|
function renderProductBlock(block: ProductBlockInnerContent, i: number, context) {
|
|
56
56
|
return (
|
|
57
|
-
<section key={String(i)} className="grow-0 shrink-0 basis-full" role="listitem">
|
|
58
|
-
<div className="p-
|
|
59
|
-
<ProductBlockInner
|
|
57
|
+
<section key={String(i)} className="flex grow-0 shrink-0 basis-full" role="listitem">
|
|
58
|
+
<div className="p-10 flex grow">
|
|
59
|
+
<ProductBlockInner
|
|
60
|
+
className="pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem]"
|
|
61
|
+
context={context}
|
|
62
|
+
{...block}
|
|
63
|
+
/>
|
|
60
64
|
</div>
|
|
61
65
|
</section>
|
|
62
66
|
);
|
package/src/ProductTile.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export const ProductTile = JSX<ProductTileProps>((props) => {
|
|
|
14
14
|
const { benefits, version } = props;
|
|
15
15
|
return (
|
|
16
16
|
<Tile {...props}>
|
|
17
|
-
<div className="flex mt-5 mb-
|
|
17
|
+
<div className="flex mt-5 mb-1">
|
|
18
18
|
{benefits?.length ? (
|
|
19
19
|
<div className="mr-8">{benefits.map(renderBenefitDescription)}</div>
|
|
20
20
|
) : null}
|
|
@@ -32,14 +32,14 @@ function renderBenefitLabel(benefit: Benefit, i: number, version = 'primary') {
|
|
|
32
32
|
secondary: 'text-white',
|
|
33
33
|
};
|
|
34
34
|
return (
|
|
35
|
-
<div key={String(i)} className={`text-sm
|
|
35
|
+
<div key={String(i)} className={`text-sm ${i ? 'mt-4' : ''} ${labelStyleMap[version]}`}>
|
|
36
36
|
{benefit.label}
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
function renderBenefitDescription(benefit: Benefit, i: number) {
|
|
41
41
|
return (
|
|
42
|
-
<div key={String(i)} className=
|
|
42
|
+
<div key={String(i)} className={`text-xl font-medium ${i ? 'mt-2.5' : ''}`}>
|
|
43
43
|
{benefit.description}
|
|
44
44
|
</div>
|
|
45
45
|
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { BaseTileContent } from './BaseTile';
|
|
3
|
+
import { Tile } from './Tile';
|
|
4
|
+
import type { UniBlockProps } from './types';
|
|
5
|
+
|
|
6
|
+
export interface PromoTileContent extends BaseTileContent {
|
|
7
|
+
date?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PromoTileProps extends PromoTileContent, UniBlockProps {}
|
|
11
|
+
|
|
12
|
+
export const PromoTile = JSX<PromoTileProps>(
|
|
13
|
+
({
|
|
14
|
+
className,
|
|
15
|
+
context,
|
|
16
|
+
title = 'Акции и спецпредложения',
|
|
17
|
+
date,
|
|
18
|
+
description,
|
|
19
|
+
buttons = [],
|
|
20
|
+
version,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
23
|
+
<Tile
|
|
24
|
+
className={className}
|
|
25
|
+
context={context}
|
|
26
|
+
title={title}
|
|
27
|
+
buttons={buttons}
|
|
28
|
+
version={version}
|
|
29
|
+
>
|
|
30
|
+
<div>
|
|
31
|
+
{date && <div className="text-sm mb-2">{formatDate(date)}</div>}
|
|
32
|
+
<div className="text-base">{description}</div>
|
|
33
|
+
</div>
|
|
34
|
+
</Tile>
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function formatDate(date: string) {
|
|
40
|
+
const dateObj = new Date(date);
|
|
41
|
+
const dateFormat: Intl.DateTimeFormatOptions = {
|
|
42
|
+
day: 'numeric',
|
|
43
|
+
month: 'long',
|
|
44
|
+
year: 'numeric',
|
|
45
|
+
};
|
|
46
|
+
return dateObj.toLocaleString('ru-RU', dateFormat).replace('г.', '');
|
|
47
|
+
}
|
package/src/Tile.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import type { BlockVersion, Picture, UniBlockProps } from './types';
|
|
3
3
|
import { BaseTile } from './BaseTile';
|
|
4
4
|
import type { BaseTileContent } from './BaseTile';
|
|
5
|
+
import { getColSpan } from './utils/getColSpan';
|
|
5
6
|
|
|
6
7
|
export interface TileProps extends BaseTileContent, UniBlockProps {}
|
|
7
8
|
|
|
@@ -12,9 +13,25 @@ const tileStyleMap: Record<BlockVersion, string> = {
|
|
|
12
13
|
|
|
13
14
|
export const Tile = JSX<TileProps>((props) => {
|
|
14
15
|
const { children, className, version = 'primary' } = props;
|
|
16
|
+
|
|
15
17
|
return (
|
|
16
|
-
<section
|
|
18
|
+
<section
|
|
19
|
+
className={`font-sans p-9 min-h-[320px] box-border ${className || ''} ${
|
|
20
|
+
tileStyleMap[version]
|
|
21
|
+
} ${getContainerPaddingRight(className)} `}
|
|
22
|
+
>
|
|
17
23
|
<BaseTile {...props}>{children}</BaseTile>
|
|
18
24
|
</section>
|
|
19
25
|
);
|
|
20
26
|
});
|
|
27
|
+
|
|
28
|
+
function getContainerPaddingRight(className: string = '') {
|
|
29
|
+
const colSpan = getColSpan(className);
|
|
30
|
+
if (colSpan <= 6) {
|
|
31
|
+
return 'pr-9';
|
|
32
|
+
} else if (colSpan <= 8) {
|
|
33
|
+
return 'pr-[4.75rem]';
|
|
34
|
+
} else {
|
|
35
|
+
return 'pr-[9.4rem]';
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/api/DaDataAPI.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGeolocation } from '../utils/getGeolocation';
|
|
2
2
|
|
|
3
3
|
import type { DaDataResult } from '../types';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ export function DaDataAPI(baseURL = '') {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
|
-
const coords = await
|
|
12
|
+
const coords = await getGeolocation();
|
|
13
13
|
const response = await fetch(`${baseURL}/geolocate`, {
|
|
14
14
|
method: 'POST',
|
|
15
15
|
mode: 'cors',
|
package/src/types.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type { ContentPageContext } from './ContentPageContext';
|
|
|
15
15
|
export type ColorPalette = 'pc' | 'bc' | 'eo';
|
|
16
16
|
|
|
17
17
|
export type BlockVersion = 'primary' | 'secondary';
|
|
18
|
+
export type ButtonVersion = 'primary' | 'secondary';
|
|
19
|
+
export type TitleSize = 'S' | 'M' | 'L' | 'XL';
|
|
18
20
|
|
|
19
21
|
export interface BlockDef {
|
|
20
22
|
type: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../setup-fixture';
|
|
2
2
|
|
|
3
3
|
import { Button } from './Button';
|
|
4
|
+
import { IconButton } from './IconButton';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
all: (
|
|
@@ -60,6 +61,27 @@ export default {
|
|
|
60
61
|
/>
|
|
61
62
|
</div>
|
|
62
63
|
</div>
|
|
64
|
+
<div>
|
|
65
|
+
<p>With Icon</p>
|
|
66
|
+
<div className="flex gap-6" data-theme="pc">
|
|
67
|
+
<IconButton
|
|
68
|
+
href="https://www.rshb.ru/"
|
|
69
|
+
target="_blank"
|
|
70
|
+
aboveText="Доступно в"
|
|
71
|
+
text="Google Play"
|
|
72
|
+
version="secondary"
|
|
73
|
+
icon="PlayMarket"
|
|
74
|
+
/>
|
|
75
|
+
<IconButton
|
|
76
|
+
href="https://www.rshb.ru/"
|
|
77
|
+
target="_blank"
|
|
78
|
+
aboveText="Загрузите в"
|
|
79
|
+
text="App Store"
|
|
80
|
+
version="secondary"
|
|
81
|
+
icon="AppleIcon"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
63
85
|
</div>
|
|
64
86
|
),
|
|
65
87
|
'primary (Private clients)': (
|
package/src/ui-kit/Button.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import type { LinkContent } from '../types';
|
|
2
|
+
import type { ButtonVersion, LinkContent } from '../types';
|
|
3
3
|
|
|
4
|
-
type ButtonVersion = 'primary' | 'secondary';
|
|
5
4
|
export interface ButtonProps extends LinkContent {
|
|
6
5
|
className?: string;
|
|
7
6
|
onClick?: (ev: MouseEvent) => any;
|
|
@@ -21,7 +20,7 @@ const buttonDisabledStyleMap: Record<ButtonVersion, string> = {
|
|
|
21
20
|
secondary: 'bg-secondary-light text-secondary-text',
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
const styleButton = 'inline-block rounded-md px-
|
|
23
|
+
const styleButton = 'inline-block rounded-md px-8 py-2 text-center font-sans';
|
|
25
24
|
|
|
26
25
|
export const Button = JSX<ButtonProps>(
|
|
27
26
|
({
|
|
@@ -46,7 +45,11 @@ export const Button = JSX<ButtonProps>(
|
|
|
46
45
|
className || ''
|
|
47
46
|
}`}
|
|
48
47
|
>
|
|
49
|
-
|
|
48
|
+
{children ? (
|
|
49
|
+
<div>{children}</div>
|
|
50
|
+
) : (
|
|
51
|
+
<div className="text-sm font-medium py-1.5">{text}</div>
|
|
52
|
+
)}
|
|
50
53
|
</div>
|
|
51
54
|
);
|
|
52
55
|
}
|
|
@@ -59,7 +62,11 @@ export const Button = JSX<ButtonProps>(
|
|
|
59
62
|
onClick={onClick}
|
|
60
63
|
aria-label={ariaLabel}
|
|
61
64
|
>
|
|
62
|
-
|
|
65
|
+
{children ? (
|
|
66
|
+
<div>{children}</div>
|
|
67
|
+
) : (
|
|
68
|
+
<div className="text-sm font-medium py-1.5">{text}</div>
|
|
69
|
+
)}
|
|
63
70
|
</a>
|
|
64
71
|
);
|
|
65
72
|
},
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { AppleIcon, PlayMarket } from '../Icons';
|
|
3
|
+
import type { ButtonProps } from './Button';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
|
|
6
|
+
const ICONS = { AppleIcon, PlayMarket };
|
|
7
|
+
|
|
8
|
+
export interface IconButtonProps extends ButtonProps {
|
|
9
|
+
icon?: string;
|
|
10
|
+
aboveText?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const IconButton = JSX<IconButtonProps>((props) => {
|
|
14
|
+
return (
|
|
15
|
+
<Button {...props}>
|
|
16
|
+
{props.icon ? (
|
|
17
|
+
<div className="flex items-center">
|
|
18
|
+
<div className="mr-2">{ICONS[props.icon as keyof typeof ICONS]?.()}</div>
|
|
19
|
+
<div>
|
|
20
|
+
<div className="text-xxs text-left">{props.aboveText}</div>
|
|
21
|
+
<div className="text-sm font-medium text-left">{props.text}</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
) : null}
|
|
25
|
+
</Button>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getCurrentPosition: () => Promise<GeolocationCoordinates>;
|