@megafon/ui-shared 5.5.1 → 5.6.0
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/CHANGELOG.md +12 -0
- package/dist/es/components/Instructions/Instructions.css +160 -6
- package/dist/es/components/Instructions/Instructions.d.ts +28 -1
- package/dist/es/components/Instructions/Instructions.js +100 -16
- package/dist/es/components/Instructions/img/android-new.png +0 -0
- package/dist/es/components/Instructions/img/iphone-new.png +0 -0
- package/dist/es/components/StoreButton/StoreButton.js +5 -5
- package/dist/lib/components/Instructions/Instructions.css +160 -6
- package/dist/lib/components/Instructions/Instructions.d.ts +28 -1
- package/dist/lib/components/Instructions/Instructions.js +106 -16
- package/dist/lib/components/Instructions/img/android-new.png +0 -0
- package/dist/lib/components/Instructions/img/iphone-new.png +0 -0
- package/dist/lib/components/StoreButton/StoreButton.js +5 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [5.6.0](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.5.1...@megafon/ui-shared@5.6.0) (2024-02-07)
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* **instructions:** add background, arrows, qr-code to Instructions component ([6f9d5ca](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/6f9d5ca210d3f5f9aae2f8d2528ce1910c88017c))
|
12
|
+
* **instructions:** review fixes ([d036717](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/commit/d0367176329a4e9f875914b6860056c2c8fecd0c))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
6
18
|
## [5.5.1](https://hq-gitlab.megafon.ru/site-portal/services/megafon-ui/compare/@megafon/ui-shared@5.5.0...@megafon/ui-shared@5.5.1) (2024-02-05)
|
7
19
|
|
8
20
|
|
@@ -45,12 +45,27 @@ h5 {
|
|
45
45
|
justify-content: center;
|
46
46
|
}
|
47
47
|
}
|
48
|
+
@media screen and (min-width: 1024px) {
|
49
|
+
.mfui-instructions__wrapper_vertical-align_top {
|
50
|
+
-webkit-box-align: start;
|
51
|
+
-ms-flex-align: start;
|
52
|
+
align-items: flex-start;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
@media screen and (min-width: 1024px) {
|
56
|
+
.mfui-instructions__wrapper_vertical-align_unset {
|
57
|
+
-webkit-box-align: unset;
|
58
|
+
-ms-flex-align: unset;
|
59
|
+
align-items: unset;
|
60
|
+
}
|
61
|
+
}
|
48
62
|
@media screen and (max-width: 1023px) {
|
49
63
|
.mfui-instructions__text {
|
50
64
|
text-align: center;
|
51
65
|
}
|
52
66
|
}
|
53
67
|
.mfui-instructions__picture {
|
68
|
+
position: relative;
|
54
69
|
max-width: 530px;
|
55
70
|
max-height: 490px;
|
56
71
|
overflow: hidden;
|
@@ -81,12 +96,6 @@ h5 {
|
|
81
96
|
margin-right: 40px;
|
82
97
|
}
|
83
98
|
}
|
84
|
-
@media screen and (min-width: 1024px) {
|
85
|
-
.mfui-instructions__picture_vertical-align_top {
|
86
|
-
-ms-flex-item-align: start;
|
87
|
-
align-self: flex-start;
|
88
|
-
}
|
89
|
-
}
|
90
99
|
.mfui-instructions_mask_none .mfui-instructions__slide {
|
91
100
|
display: -webkit-box;
|
92
101
|
display: -ms-flexbox;
|
@@ -226,6 +235,93 @@ h5 {
|
|
226
235
|
border-radius: 20px;
|
227
236
|
overflow: hidden;
|
228
237
|
}
|
238
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper {
|
239
|
+
height: 420px;
|
240
|
+
min-height: 420px;
|
241
|
+
}
|
242
|
+
@media screen and (min-width: 1024px) {
|
243
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper {
|
244
|
+
height: 440px;
|
245
|
+
min-height: 440px;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper:before {
|
249
|
+
content: '';
|
250
|
+
position: absolute;
|
251
|
+
right: 0;
|
252
|
+
bottom: 0;
|
253
|
+
left: 0;
|
254
|
+
z-index: 2;
|
255
|
+
display: block;
|
256
|
+
width: 324px;
|
257
|
+
height: 1px;
|
258
|
+
margin: 0 auto;
|
259
|
+
background: var(--spbSky2);
|
260
|
+
}
|
261
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__device-screen {
|
262
|
+
position: relative;
|
263
|
+
z-index: 1;
|
264
|
+
width: 100%;
|
265
|
+
height: 510px;
|
266
|
+
margin-top: 24px;
|
267
|
+
background: url('./img/android-new.png') 50% no-repeat;
|
268
|
+
background-size: contain;
|
269
|
+
}
|
270
|
+
@media screen and (min-width: 1024px) {
|
271
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__device-screen {
|
272
|
+
height: 574px;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__swiper {
|
276
|
+
position: absolute;
|
277
|
+
top: 54px;
|
278
|
+
right: 0;
|
279
|
+
left: 0;
|
280
|
+
width: 222px;
|
281
|
+
margin: auto;
|
282
|
+
overflow: hidden;
|
283
|
+
}
|
284
|
+
@media screen and (min-width: 1024px) {
|
285
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__swiper {
|
286
|
+
top: 58px;
|
287
|
+
width: 250px;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__img-wrapper {
|
291
|
+
height: 420px;
|
292
|
+
min-height: 420px;
|
293
|
+
}
|
294
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__img-wrapper:before {
|
295
|
+
content: '';
|
296
|
+
position: absolute;
|
297
|
+
right: 0;
|
298
|
+
bottom: 0;
|
299
|
+
left: 0;
|
300
|
+
z-index: 2;
|
301
|
+
display: block;
|
302
|
+
width: 324px;
|
303
|
+
height: 1px;
|
304
|
+
margin: 0 auto;
|
305
|
+
background: var(--spbSky2);
|
306
|
+
}
|
307
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__device-screen {
|
308
|
+
position: relative;
|
309
|
+
z-index: 1;
|
310
|
+
width: 100%;
|
311
|
+
height: 469px;
|
312
|
+
margin-top: 24px;
|
313
|
+
background: url('./img/iphone-new.png') 50% no-repeat;
|
314
|
+
background-size: contain;
|
315
|
+
}
|
316
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__swiper {
|
317
|
+
position: absolute;
|
318
|
+
top: 38px;
|
319
|
+
right: 0;
|
320
|
+
left: 0;
|
321
|
+
width: 205px;
|
322
|
+
margin: auto;
|
323
|
+
overflow: hidden;
|
324
|
+
}
|
229
325
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
230
326
|
.mfui-instructions_mask_laptop .mfui-instructions__img-wrapper {
|
231
327
|
height: 283px;
|
@@ -497,3 +593,61 @@ h5 {
|
|
497
593
|
line-height: 24px;
|
498
594
|
font-weight: 400;
|
499
595
|
}
|
596
|
+
.mfui-instructions__picture_background_spbSky0 {
|
597
|
+
border-radius: 12px;
|
598
|
+
background-color: var(--spbSky0);
|
599
|
+
}
|
600
|
+
.mfui-instructions__picture_background_spbSky0 .mfui-instructions__img-wrapper:before {
|
601
|
+
display: none;
|
602
|
+
}
|
603
|
+
.mfui-instructions__arrow {
|
604
|
+
position: absolute;
|
605
|
+
top: 50%;
|
606
|
+
z-index: 2;
|
607
|
+
-webkit-transform: translateY(-50%);
|
608
|
+
transform: translateY(-50%);
|
609
|
+
}
|
610
|
+
@media screen and (max-width: 767px) {
|
611
|
+
.mfui-instructions__arrow {
|
612
|
+
display: none;
|
613
|
+
}
|
614
|
+
}
|
615
|
+
.mfui-instructions__arrow_prev {
|
616
|
+
left: 24px;
|
617
|
+
}
|
618
|
+
.mfui-instructions__arrow_next {
|
619
|
+
right: 24px;
|
620
|
+
}
|
621
|
+
.mfui-instructions__qr-code {
|
622
|
+
position: absolute;
|
623
|
+
top: 12px;
|
624
|
+
right: 64px;
|
625
|
+
z-index: 3;
|
626
|
+
display: none;
|
627
|
+
-webkit-box-sizing: border-box;
|
628
|
+
box-sizing: border-box;
|
629
|
+
width: 126px;
|
630
|
+
padding: 12px;
|
631
|
+
}
|
632
|
+
@media screen and (min-width: 768px) {
|
633
|
+
.mfui-instructions__qr-code {
|
634
|
+
display: block;
|
635
|
+
}
|
636
|
+
}
|
637
|
+
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
638
|
+
.mfui-instructions__qr-code {
|
639
|
+
right: 44px;
|
640
|
+
}
|
641
|
+
}
|
642
|
+
.mfui-instructions__qr-code-image {
|
643
|
+
display: block;
|
644
|
+
width: 100%;
|
645
|
+
height: auto;
|
646
|
+
}
|
647
|
+
.mfui-instructions__qr-code-text {
|
648
|
+
margin-bottom: 12px;
|
649
|
+
font-weight: 500;
|
650
|
+
font-size: 12px;
|
651
|
+
line-height: 12px;
|
652
|
+
text-align: center;
|
653
|
+
}
|
@@ -8,24 +8,40 @@ export declare const pictureAlignTypes: {
|
|
8
8
|
export declare const pictureVerticalAlignTypes: {
|
9
9
|
CENTER: string;
|
10
10
|
TOP: string;
|
11
|
+
UNSET: string;
|
11
12
|
};
|
12
13
|
export declare const pictureMaskTypes: {
|
13
14
|
readonly ANDROID: "android";
|
15
|
+
readonly ANDROID_CROPPED: "android-cropped";
|
14
16
|
readonly NEW_IPHONE: "new-iphone";
|
15
17
|
readonly BLACK_IPHONE: "black-iphone";
|
16
18
|
readonly WHITE_IPHONE: "white-iphone";
|
17
19
|
readonly LAPTOP: "laptop";
|
18
20
|
readonly IPHONE_12: "iphone-12";
|
21
|
+
readonly IPHONE_CROPPED: "iphone-cropped";
|
19
22
|
readonly NONE: "none";
|
20
23
|
};
|
24
|
+
export declare const pictureBackgroundColorTypes: {
|
25
|
+
readonly SPB_SKY_0: "spbSky0";
|
26
|
+
};
|
27
|
+
export declare const arrowTheme: {
|
28
|
+
readonly PURPLE: "purple";
|
29
|
+
readonly DARK: "dark";
|
30
|
+
};
|
21
31
|
declare type PictureAlignTypesType = typeof pictureAlignTypes[keyof typeof pictureAlignTypes];
|
22
32
|
declare type PictureVerticalAlignTypesType = typeof pictureVerticalAlignTypes[keyof typeof pictureVerticalAlignTypes];
|
23
33
|
declare type PictureMaskTypesType = typeof pictureMaskTypes[keyof typeof pictureMaskTypes];
|
34
|
+
declare type PictureBackgroundColorsType = typeof pictureBackgroundColorTypes[keyof typeof pictureBackgroundColorTypes];
|
35
|
+
declare type ArrowThemeType = typeof arrowTheme[keyof typeof arrowTheme];
|
24
36
|
export declare type InstructionItemType = {
|
25
37
|
title: string | React.ReactNode | React.ReactNode[];
|
26
38
|
mediaUrl: string;
|
27
39
|
isVideo: boolean;
|
28
40
|
imageAlt?: string;
|
41
|
+
/** Ссылка на изображение с QR-кодом */
|
42
|
+
qrCode?: string;
|
43
|
+
/** Текст для плашки с изображением QR-кода */
|
44
|
+
qrCodeText?: string | React.ReactNode | React.ReactNode[];
|
29
45
|
};
|
30
46
|
export interface IInstructionsProps {
|
31
47
|
/** Дополнительные data атрибуты к внутренним элементам */
|
@@ -34,6 +50,9 @@ export interface IInstructionsProps {
|
|
34
50
|
item?: Record<string, string>;
|
35
51
|
image?: Record<string, string>;
|
36
52
|
mobileItemText?: Record<string, string>;
|
53
|
+
wrapper?: Record<string, string>;
|
54
|
+
arrowPrev?: Record<string, string>;
|
55
|
+
arrowNext?: Record<string, string>;
|
37
56
|
};
|
38
57
|
/** Ссылка на корневой элемент */
|
39
58
|
rootRef?: Ref<HTMLDivElement>;
|
@@ -47,9 +66,11 @@ export interface IInstructionsProps {
|
|
47
66
|
mobileItemTitle?: string;
|
48
67
|
instructionItemImg?: string;
|
49
68
|
additionalText?: string;
|
69
|
+
arrowPrev?: string;
|
70
|
+
arrowNext?: string;
|
50
71
|
};
|
51
72
|
/** Заголовок инструкции */
|
52
|
-
title
|
73
|
+
title?: string;
|
53
74
|
/** Пункты инструкции */
|
54
75
|
instructionItems: InstructionItemType[];
|
55
76
|
/** Описание после инструкции */
|
@@ -60,6 +81,12 @@ export interface IInstructionsProps {
|
|
60
81
|
pictureVerticalAlign?: PictureVerticalAlignTypesType;
|
61
82
|
/** Маска изображения */
|
62
83
|
pictureMask?: PictureMaskTypesType;
|
84
|
+
/** Цвет фона изображения */
|
85
|
+
pictureBackgroundColor?: PictureBackgroundColorsType;
|
86
|
+
/** Показать стрелки для смены пунктов инструкции */
|
87
|
+
showArrows?: boolean;
|
88
|
+
/** Цветовая тема стрелок навигации */
|
89
|
+
arrowsTheme?: ArrowThemeType;
|
63
90
|
/** Ref на swiper */
|
64
91
|
getSwiper?: (instance: SwiperCore) => void;
|
65
92
|
}
|
@@ -6,7 +6,7 @@ import "core-js/modules/es.array.map.js";
|
|
6
6
|
|
7
7
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
8
8
|
import React from 'react';
|
9
|
-
import { Grid, GridColumn, Header, Paragraph } from '@megafon/ui-core';
|
9
|
+
import { Grid, GridColumn, Header, NavArrow, Paragraph, Tile } from '@megafon/ui-core';
|
10
10
|
import { cnCreate, filterDataAttrs, titleConvertConfig, convert, textConvertConfig } from '@megafon/ui-helpers';
|
11
11
|
import PropTypes from 'prop-types';
|
12
12
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
@@ -17,17 +17,27 @@ export var pictureAlignTypes = {
|
|
17
17
|
};
|
18
18
|
export var pictureVerticalAlignTypes = {
|
19
19
|
CENTER: 'center',
|
20
|
-
TOP: 'top'
|
20
|
+
TOP: 'top',
|
21
|
+
UNSET: 'unset'
|
21
22
|
};
|
22
23
|
export var pictureMaskTypes = {
|
23
24
|
ANDROID: 'android',
|
25
|
+
ANDROID_CROPPED: 'android-cropped',
|
24
26
|
NEW_IPHONE: 'new-iphone',
|
25
27
|
BLACK_IPHONE: 'black-iphone',
|
26
28
|
WHITE_IPHONE: 'white-iphone',
|
27
29
|
LAPTOP: 'laptop',
|
28
30
|
IPHONE_12: 'iphone-12',
|
31
|
+
IPHONE_CROPPED: 'iphone-cropped',
|
29
32
|
NONE: 'none'
|
30
33
|
};
|
34
|
+
export var pictureBackgroundColorTypes = {
|
35
|
+
SPB_SKY_0: 'spbSky0'
|
36
|
+
};
|
37
|
+
export var arrowTheme = {
|
38
|
+
PURPLE: 'purple',
|
39
|
+
DARK: 'dark'
|
40
|
+
};
|
31
41
|
var testIdPrefix = 'Instructions';
|
32
42
|
var cn = cnCreate('mfui-instructions');
|
33
43
|
var swiperSlideCn = cn('slide');
|
@@ -45,7 +55,10 @@ var Instructions = function Instructions(_ref) {
|
|
45
55
|
mobileItemTitle = _ref$classes.mobileItemTitle,
|
46
56
|
instructionItemImg = _ref$classes.instructionItemImg,
|
47
57
|
additionalText = _ref$classes.additionalText,
|
48
|
-
|
58
|
+
arrowPrev = _ref$classes.arrowPrev,
|
59
|
+
arrowNext = _ref$classes.arrowNext,
|
60
|
+
_ref$title = _ref.title,
|
61
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
49
62
|
instructionItems = _ref.instructionItems,
|
50
63
|
_ref$pictureAlign = _ref.pictureAlign,
|
51
64
|
pictureAlign = _ref$pictureAlign === void 0 ? 'left' : _ref$pictureAlign,
|
@@ -53,8 +66,12 @@ var Instructions = function Instructions(_ref) {
|
|
53
66
|
pictureVerticalAlign = _ref$pictureVerticalA === void 0 ? 'center' : _ref$pictureVerticalA,
|
54
67
|
_ref$pictureMask = _ref.pictureMask,
|
55
68
|
pictureMask = _ref$pictureMask === void 0 ? 'none' : _ref$pictureMask,
|
69
|
+
pictureBackgroundColor = _ref.pictureBackgroundColor,
|
56
70
|
getSwiper = _ref.getSwiper,
|
57
71
|
text = _ref.additionalText,
|
72
|
+
showArrows = _ref.showArrows,
|
73
|
+
_ref$arrowsTheme = _ref.arrowsTheme,
|
74
|
+
arrowsTheme = _ref$arrowsTheme === void 0 ? arrowTheme.DARK : _ref$arrowsTheme,
|
58
75
|
children = _ref.children;
|
59
76
|
|
60
77
|
var _React$useState = React.useState(),
|
@@ -88,6 +105,20 @@ var Instructions = function Instructions(_ref) {
|
|
88
105
|
var activeIndex = _ref2.activeIndex;
|
89
106
|
setSlideIndex(activeIndex);
|
90
107
|
}, []);
|
108
|
+
var handlePrevClick = React.useCallback(function () {
|
109
|
+
if (!swiperInstance) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
|
113
|
+
swiperInstance.slidePrev();
|
114
|
+
}, [swiperInstance]);
|
115
|
+
var handleNextClick = React.useCallback(function () {
|
116
|
+
if (!swiperInstance) {
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
|
120
|
+
swiperInstance.slideNext();
|
121
|
+
}, [swiperInstance]);
|
91
122
|
var renderVideo = React.useCallback(function (mediaUrl, index) {
|
92
123
|
return /*#__PURE__*/React.createElement("video", _extends({
|
93
124
|
loop: true,
|
@@ -132,6 +163,24 @@ var Instructions = function Instructions(_ref) {
|
|
132
163
|
as: "h2"
|
133
164
|
}, convert(title, titleConvertConfig));
|
134
165
|
}, [title]);
|
166
|
+
var renderQrCode = React.useCallback(function () {
|
167
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, instructionItems.map(function (_ref4, i) {
|
168
|
+
var qrCode = _ref4.qrCode,
|
169
|
+
qrCodeText = _ref4.qrCodeText;
|
170
|
+
return slideIndex === i && !!qrCode && /*#__PURE__*/React.createElement(Tile, {
|
171
|
+
className: cn('qr-code'),
|
172
|
+
radius: "rounded",
|
173
|
+
shadowLevel: "default",
|
174
|
+
key: qrCode
|
175
|
+
}, !!qrCodeText && /*#__PURE__*/React.createElement("div", {
|
176
|
+
className: cn('qr-code-text')
|
177
|
+
}, qrCodeText), /*#__PURE__*/React.createElement("img", {
|
178
|
+
src: qrCode,
|
179
|
+
className: cn('qr-code-image'),
|
180
|
+
alt: "QR-\u043A\u043E\u0434"
|
181
|
+
}));
|
182
|
+
}));
|
183
|
+
}, [instructionItems, slideIndex]);
|
135
184
|
var renderText = React.useCallback(function () {
|
136
185
|
return /*#__PURE__*/React.createElement(Paragraph, {
|
137
186
|
className: cn('text', [additionalText]),
|
@@ -157,8 +206,8 @@ var Instructions = function Instructions(_ref) {
|
|
157
206
|
desktop: true
|
158
207
|
}),
|
159
208
|
"data-testid": "".concat(testIdPrefix, "-articles-list-desktop")
|
160
|
-
}, instructionItems.map(function (
|
161
|
-
var itemTitle =
|
209
|
+
}, instructionItems.map(function (_ref5, i) {
|
210
|
+
var itemTitle = _ref5.title;
|
162
211
|
return (
|
163
212
|
/*#__PURE__*/
|
164
213
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
@@ -187,8 +236,8 @@ var Instructions = function Instructions(_ref) {
|
|
187
236
|
"data-testid": "".concat(testIdPrefix, "-articles-list-mobile")
|
188
237
|
}, /*#__PURE__*/React.createElement("div", {
|
189
238
|
className: cn('articles-title-block')
|
190
|
-
}, instructionItems.map(function (
|
191
|
-
var itemTitle =
|
239
|
+
}, instructionItems.map(function (_ref6, i) {
|
240
|
+
var itemTitle = _ref6.title;
|
192
241
|
return slideIndex === i && /*#__PURE__*/React.createElement("div", _extends({
|
193
242
|
key: i,
|
194
243
|
"data-index": i
|
@@ -212,6 +261,30 @@ var Instructions = function Instructions(_ref) {
|
|
212
261
|
}, i + 1));
|
213
262
|
})));
|
214
263
|
}, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mobileItemText, getActiveCustomClass, handleArticleClick, instructionItem, instructionItems, mobileInstructionItem, mobileItemTitle, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, slideIndex, text]);
|
264
|
+
var renderArrows = React.useCallback(function () {
|
265
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NavArrow, {
|
266
|
+
dataAttrs: {
|
267
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev
|
268
|
+
},
|
269
|
+
className: cn('arrow', {
|
270
|
+
prev: true
|
271
|
+
}, [arrowPrev]),
|
272
|
+
theme: arrowsTheme,
|
273
|
+
disabled: slideIndex === 0,
|
274
|
+
onClick: handlePrevClick
|
275
|
+
}), /*#__PURE__*/React.createElement(NavArrow, {
|
276
|
+
dataAttrs: {
|
277
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext
|
278
|
+
},
|
279
|
+
className: cn('arrow', {
|
280
|
+
next: true
|
281
|
+
}, [arrowNext]),
|
282
|
+
view: "next",
|
283
|
+
theme: arrowsTheme,
|
284
|
+
disabled: slideIndex === instructionItems.length - 1,
|
285
|
+
onClick: handleNextClick
|
286
|
+
}));
|
287
|
+
}, [handlePrevClick, handleNextClick, arrowsTheme, arrowPrev, arrowNext, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext, slideIndex, instructionItems.length]);
|
215
288
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
216
289
|
className: cn({
|
217
290
|
mask: pictureMask
|
@@ -221,19 +294,21 @@ var Instructions = function Instructions(_ref) {
|
|
221
294
|
hAlign: "center"
|
222
295
|
}, /*#__PURE__*/React.createElement(GridColumn, {
|
223
296
|
all: "12"
|
224
|
-
}, renderTitle('mobile'), /*#__PURE__*/React.createElement("div", {
|
225
|
-
className: cn('wrapper'
|
226
|
-
|
297
|
+
}, !!title && renderTitle('mobile'), /*#__PURE__*/React.createElement("div", _extends({
|
298
|
+
className: cn('wrapper', {
|
299
|
+
'vertical-align': pictureVerticalAlign
|
300
|
+
})
|
301
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.wrapper)), /*#__PURE__*/React.createElement("div", {
|
227
302
|
className: cn('picture', {
|
228
303
|
align: pictureAlign,
|
229
|
-
|
304
|
+
background: pictureBackgroundColor
|
230
305
|
}),
|
231
306
|
"data-testid": "".concat(testIdPrefix, "-picture")
|
232
|
-
}, renderPicture()), /*#__PURE__*/React.createElement("div", {
|
307
|
+
}, renderPicture(), !!showArrows && renderArrows(), renderQrCode()), /*#__PURE__*/React.createElement("div", {
|
233
308
|
className: cn('articles', {
|
234
309
|
align: pictureAlign
|
235
310
|
})
|
236
|
-
}, renderTitle('desktop'), renderMobileArticles(), renderDesktopArticles(), text && renderText(), children)))));
|
311
|
+
}, !!title && renderTitle('desktop'), renderMobileArticles(), renderDesktopArticles(), text && renderText(), children)))));
|
237
312
|
};
|
238
313
|
|
239
314
|
Instructions.propTypes = {
|
@@ -241,7 +316,10 @@ Instructions.propTypes = {
|
|
241
316
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
242
317
|
item: PropTypes.objectOf(PropTypes.string.isRequired),
|
243
318
|
image: PropTypes.objectOf(PropTypes.string.isRequired),
|
244
|
-
mobileItemText: PropTypes.objectOf(PropTypes.string.isRequired)
|
319
|
+
mobileItemText: PropTypes.objectOf(PropTypes.string.isRequired),
|
320
|
+
wrapper: PropTypes.objectOf(PropTypes.string.isRequired),
|
321
|
+
arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
|
322
|
+
arrowNext: PropTypes.objectOf(PropTypes.string.isRequired)
|
245
323
|
}),
|
246
324
|
rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
247
325
|
current: PropTypes.elementType
|
@@ -253,9 +331,11 @@ Instructions.propTypes = {
|
|
253
331
|
activeInstructionItem: PropTypes.string,
|
254
332
|
desktopItemTitle: PropTypes.string,
|
255
333
|
mobileItemTitle: PropTypes.string,
|
256
|
-
instructionItemImg: PropTypes.string
|
334
|
+
instructionItemImg: PropTypes.string,
|
335
|
+
arrowPrev: PropTypes.string,
|
336
|
+
arrowNext: PropTypes.string
|
257
337
|
}),
|
258
|
-
title: PropTypes.string
|
338
|
+
title: PropTypes.string,
|
259
339
|
additionalText: PropTypes.string,
|
260
340
|
instructionItems: PropTypes.arrayOf(PropTypes.shape({
|
261
341
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]).isRequired,
|
@@ -264,7 +344,11 @@ Instructions.propTypes = {
|
|
264
344
|
imageAlt: PropTypes.string
|
265
345
|
}).isRequired).isRequired,
|
266
346
|
pictureAlign: PropTypes.oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
347
|
+
pictureVerticalAlign: PropTypes.oneOf([pictureVerticalAlignTypes.CENTER, pictureVerticalAlignTypes.TOP, pictureVerticalAlignTypes.UNSET]),
|
267
348
|
pictureMask: PropTypes.oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
349
|
+
pictureBackgroundColor: PropTypes.oneOf([pictureBackgroundColorTypes.SPB_SKY_0]),
|
350
|
+
showArrows: PropTypes.bool,
|
351
|
+
arrowsTheme: PropTypes.oneOf([arrowTheme.DARK, arrowTheme.PURPLE]),
|
268
352
|
getSwiper: PropTypes.func
|
269
353
|
};
|
270
354
|
export default Instructions;
|
Binary file
|
Binary file
|
@@ -79,11 +79,11 @@ StoreButton.propTypes = {
|
|
79
79
|
onClick: PropTypes.func,
|
80
80
|
className: PropTypes.string,
|
81
81
|
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
82
|
-
sizeAll: PropTypes.oneOf(Object.values(ButtonSizes))
|
83
|
-
sizeWide: PropTypes.oneOf(Object.values(ButtonSizes))
|
84
|
-
sizeDesktop: PropTypes.oneOf(Object.values(ButtonSizes))
|
85
|
-
sizeTablet: PropTypes.oneOf(Object.values(ButtonSizes))
|
86
|
-
sizeMobile: PropTypes.oneOf(Object.values(ButtonSizes))
|
82
|
+
sizeAll: PropTypes.oneOf(Object.values(ButtonSizes)),
|
83
|
+
sizeWide: PropTypes.oneOf(Object.values(ButtonSizes)),
|
84
|
+
sizeDesktop: PropTypes.oneOf(Object.values(ButtonSizes)),
|
85
|
+
sizeTablet: PropTypes.oneOf(Object.values(ButtonSizes)),
|
86
|
+
sizeMobile: PropTypes.oneOf(Object.values(ButtonSizes)),
|
87
87
|
dataAttrs: PropTypes.shape({
|
88
88
|
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
89
89
|
})
|
@@ -45,12 +45,27 @@ h5 {
|
|
45
45
|
justify-content: center;
|
46
46
|
}
|
47
47
|
}
|
48
|
+
@media screen and (min-width: 1024px) {
|
49
|
+
.mfui-instructions__wrapper_vertical-align_top {
|
50
|
+
-webkit-box-align: start;
|
51
|
+
-ms-flex-align: start;
|
52
|
+
align-items: flex-start;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
@media screen and (min-width: 1024px) {
|
56
|
+
.mfui-instructions__wrapper_vertical-align_unset {
|
57
|
+
-webkit-box-align: unset;
|
58
|
+
-ms-flex-align: unset;
|
59
|
+
align-items: unset;
|
60
|
+
}
|
61
|
+
}
|
48
62
|
@media screen and (max-width: 1023px) {
|
49
63
|
.mfui-instructions__text {
|
50
64
|
text-align: center;
|
51
65
|
}
|
52
66
|
}
|
53
67
|
.mfui-instructions__picture {
|
68
|
+
position: relative;
|
54
69
|
max-width: 530px;
|
55
70
|
max-height: 490px;
|
56
71
|
overflow: hidden;
|
@@ -81,12 +96,6 @@ h5 {
|
|
81
96
|
margin-right: 40px;
|
82
97
|
}
|
83
98
|
}
|
84
|
-
@media screen and (min-width: 1024px) {
|
85
|
-
.mfui-instructions__picture_vertical-align_top {
|
86
|
-
-ms-flex-item-align: start;
|
87
|
-
align-self: flex-start;
|
88
|
-
}
|
89
|
-
}
|
90
99
|
.mfui-instructions_mask_none .mfui-instructions__slide {
|
91
100
|
display: -webkit-box;
|
92
101
|
display: -ms-flexbox;
|
@@ -226,6 +235,93 @@ h5 {
|
|
226
235
|
border-radius: 20px;
|
227
236
|
overflow: hidden;
|
228
237
|
}
|
238
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper {
|
239
|
+
height: 420px;
|
240
|
+
min-height: 420px;
|
241
|
+
}
|
242
|
+
@media screen and (min-width: 1024px) {
|
243
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper {
|
244
|
+
height: 440px;
|
245
|
+
min-height: 440px;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__img-wrapper:before {
|
249
|
+
content: '';
|
250
|
+
position: absolute;
|
251
|
+
right: 0;
|
252
|
+
bottom: 0;
|
253
|
+
left: 0;
|
254
|
+
z-index: 2;
|
255
|
+
display: block;
|
256
|
+
width: 324px;
|
257
|
+
height: 1px;
|
258
|
+
margin: 0 auto;
|
259
|
+
background: var(--spbSky2);
|
260
|
+
}
|
261
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__device-screen {
|
262
|
+
position: relative;
|
263
|
+
z-index: 1;
|
264
|
+
width: 100%;
|
265
|
+
height: 510px;
|
266
|
+
margin-top: 24px;
|
267
|
+
background: url('./img/android-new.png') 50% no-repeat;
|
268
|
+
background-size: contain;
|
269
|
+
}
|
270
|
+
@media screen and (min-width: 1024px) {
|
271
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__device-screen {
|
272
|
+
height: 574px;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__swiper {
|
276
|
+
position: absolute;
|
277
|
+
top: 54px;
|
278
|
+
right: 0;
|
279
|
+
left: 0;
|
280
|
+
width: 222px;
|
281
|
+
margin: auto;
|
282
|
+
overflow: hidden;
|
283
|
+
}
|
284
|
+
@media screen and (min-width: 1024px) {
|
285
|
+
.mfui-instructions_mask_android-cropped .mfui-instructions__swiper {
|
286
|
+
top: 58px;
|
287
|
+
width: 250px;
|
288
|
+
}
|
289
|
+
}
|
290
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__img-wrapper {
|
291
|
+
height: 420px;
|
292
|
+
min-height: 420px;
|
293
|
+
}
|
294
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__img-wrapper:before {
|
295
|
+
content: '';
|
296
|
+
position: absolute;
|
297
|
+
right: 0;
|
298
|
+
bottom: 0;
|
299
|
+
left: 0;
|
300
|
+
z-index: 2;
|
301
|
+
display: block;
|
302
|
+
width: 324px;
|
303
|
+
height: 1px;
|
304
|
+
margin: 0 auto;
|
305
|
+
background: var(--spbSky2);
|
306
|
+
}
|
307
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__device-screen {
|
308
|
+
position: relative;
|
309
|
+
z-index: 1;
|
310
|
+
width: 100%;
|
311
|
+
height: 469px;
|
312
|
+
margin-top: 24px;
|
313
|
+
background: url('./img/iphone-new.png') 50% no-repeat;
|
314
|
+
background-size: contain;
|
315
|
+
}
|
316
|
+
.mfui-instructions_mask_iphone-cropped .mfui-instructions__swiper {
|
317
|
+
position: absolute;
|
318
|
+
top: 38px;
|
319
|
+
right: 0;
|
320
|
+
left: 0;
|
321
|
+
width: 205px;
|
322
|
+
margin: auto;
|
323
|
+
overflow: hidden;
|
324
|
+
}
|
229
325
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
230
326
|
.mfui-instructions_mask_laptop .mfui-instructions__img-wrapper {
|
231
327
|
height: 283px;
|
@@ -497,3 +593,61 @@ h5 {
|
|
497
593
|
line-height: 24px;
|
498
594
|
font-weight: 400;
|
499
595
|
}
|
596
|
+
.mfui-instructions__picture_background_spbSky0 {
|
597
|
+
border-radius: 12px;
|
598
|
+
background-color: var(--spbSky0);
|
599
|
+
}
|
600
|
+
.mfui-instructions__picture_background_spbSky0 .mfui-instructions__img-wrapper:before {
|
601
|
+
display: none;
|
602
|
+
}
|
603
|
+
.mfui-instructions__arrow {
|
604
|
+
position: absolute;
|
605
|
+
top: 50%;
|
606
|
+
z-index: 2;
|
607
|
+
-webkit-transform: translateY(-50%);
|
608
|
+
transform: translateY(-50%);
|
609
|
+
}
|
610
|
+
@media screen and (max-width: 767px) {
|
611
|
+
.mfui-instructions__arrow {
|
612
|
+
display: none;
|
613
|
+
}
|
614
|
+
}
|
615
|
+
.mfui-instructions__arrow_prev {
|
616
|
+
left: 24px;
|
617
|
+
}
|
618
|
+
.mfui-instructions__arrow_next {
|
619
|
+
right: 24px;
|
620
|
+
}
|
621
|
+
.mfui-instructions__qr-code {
|
622
|
+
position: absolute;
|
623
|
+
top: 12px;
|
624
|
+
right: 64px;
|
625
|
+
z-index: 3;
|
626
|
+
display: none;
|
627
|
+
-webkit-box-sizing: border-box;
|
628
|
+
box-sizing: border-box;
|
629
|
+
width: 126px;
|
630
|
+
padding: 12px;
|
631
|
+
}
|
632
|
+
@media screen and (min-width: 768px) {
|
633
|
+
.mfui-instructions__qr-code {
|
634
|
+
display: block;
|
635
|
+
}
|
636
|
+
}
|
637
|
+
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
638
|
+
.mfui-instructions__qr-code {
|
639
|
+
right: 44px;
|
640
|
+
}
|
641
|
+
}
|
642
|
+
.mfui-instructions__qr-code-image {
|
643
|
+
display: block;
|
644
|
+
width: 100%;
|
645
|
+
height: auto;
|
646
|
+
}
|
647
|
+
.mfui-instructions__qr-code-text {
|
648
|
+
margin-bottom: 12px;
|
649
|
+
font-weight: 500;
|
650
|
+
font-size: 12px;
|
651
|
+
line-height: 12px;
|
652
|
+
text-align: center;
|
653
|
+
}
|
@@ -8,24 +8,40 @@ export declare const pictureAlignTypes: {
|
|
8
8
|
export declare const pictureVerticalAlignTypes: {
|
9
9
|
CENTER: string;
|
10
10
|
TOP: string;
|
11
|
+
UNSET: string;
|
11
12
|
};
|
12
13
|
export declare const pictureMaskTypes: {
|
13
14
|
readonly ANDROID: "android";
|
15
|
+
readonly ANDROID_CROPPED: "android-cropped";
|
14
16
|
readonly NEW_IPHONE: "new-iphone";
|
15
17
|
readonly BLACK_IPHONE: "black-iphone";
|
16
18
|
readonly WHITE_IPHONE: "white-iphone";
|
17
19
|
readonly LAPTOP: "laptop";
|
18
20
|
readonly IPHONE_12: "iphone-12";
|
21
|
+
readonly IPHONE_CROPPED: "iphone-cropped";
|
19
22
|
readonly NONE: "none";
|
20
23
|
};
|
24
|
+
export declare const pictureBackgroundColorTypes: {
|
25
|
+
readonly SPB_SKY_0: "spbSky0";
|
26
|
+
};
|
27
|
+
export declare const arrowTheme: {
|
28
|
+
readonly PURPLE: "purple";
|
29
|
+
readonly DARK: "dark";
|
30
|
+
};
|
21
31
|
declare type PictureAlignTypesType = typeof pictureAlignTypes[keyof typeof pictureAlignTypes];
|
22
32
|
declare type PictureVerticalAlignTypesType = typeof pictureVerticalAlignTypes[keyof typeof pictureVerticalAlignTypes];
|
23
33
|
declare type PictureMaskTypesType = typeof pictureMaskTypes[keyof typeof pictureMaskTypes];
|
34
|
+
declare type PictureBackgroundColorsType = typeof pictureBackgroundColorTypes[keyof typeof pictureBackgroundColorTypes];
|
35
|
+
declare type ArrowThemeType = typeof arrowTheme[keyof typeof arrowTheme];
|
24
36
|
export declare type InstructionItemType = {
|
25
37
|
title: string | React.ReactNode | React.ReactNode[];
|
26
38
|
mediaUrl: string;
|
27
39
|
isVideo: boolean;
|
28
40
|
imageAlt?: string;
|
41
|
+
/** Ссылка на изображение с QR-кодом */
|
42
|
+
qrCode?: string;
|
43
|
+
/** Текст для плашки с изображением QR-кода */
|
44
|
+
qrCodeText?: string | React.ReactNode | React.ReactNode[];
|
29
45
|
};
|
30
46
|
export interface IInstructionsProps {
|
31
47
|
/** Дополнительные data атрибуты к внутренним элементам */
|
@@ -34,6 +50,9 @@ export interface IInstructionsProps {
|
|
34
50
|
item?: Record<string, string>;
|
35
51
|
image?: Record<string, string>;
|
36
52
|
mobileItemText?: Record<string, string>;
|
53
|
+
wrapper?: Record<string, string>;
|
54
|
+
arrowPrev?: Record<string, string>;
|
55
|
+
arrowNext?: Record<string, string>;
|
37
56
|
};
|
38
57
|
/** Ссылка на корневой элемент */
|
39
58
|
rootRef?: Ref<HTMLDivElement>;
|
@@ -47,9 +66,11 @@ export interface IInstructionsProps {
|
|
47
66
|
mobileItemTitle?: string;
|
48
67
|
instructionItemImg?: string;
|
49
68
|
additionalText?: string;
|
69
|
+
arrowPrev?: string;
|
70
|
+
arrowNext?: string;
|
50
71
|
};
|
51
72
|
/** Заголовок инструкции */
|
52
|
-
title
|
73
|
+
title?: string;
|
53
74
|
/** Пункты инструкции */
|
54
75
|
instructionItems: InstructionItemType[];
|
55
76
|
/** Описание после инструкции */
|
@@ -60,6 +81,12 @@ export interface IInstructionsProps {
|
|
60
81
|
pictureVerticalAlign?: PictureVerticalAlignTypesType;
|
61
82
|
/** Маска изображения */
|
62
83
|
pictureMask?: PictureMaskTypesType;
|
84
|
+
/** Цвет фона изображения */
|
85
|
+
pictureBackgroundColor?: PictureBackgroundColorsType;
|
86
|
+
/** Показать стрелки для смены пунктов инструкции */
|
87
|
+
showArrows?: boolean;
|
88
|
+
/** Цветовая тема стрелок навигации */
|
89
|
+
arrowsTheme?: ArrowThemeType;
|
63
90
|
/** Ref на swiper */
|
64
91
|
getSwiper?: (instance: SwiperCore) => void;
|
65
92
|
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports["default"] = exports.pictureMaskTypes = exports.pictureVerticalAlignTypes = exports.pictureAlignTypes = void 0;
|
6
|
+
exports["default"] = exports.arrowTheme = exports.pictureBackgroundColorTypes = exports.pictureMaskTypes = exports.pictureVerticalAlignTypes = exports.pictureAlignTypes = void 0;
|
7
7
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
9
|
|
@@ -33,19 +33,31 @@ var pictureAlignTypes = {
|
|
33
33
|
exports.pictureAlignTypes = pictureAlignTypes;
|
34
34
|
var pictureVerticalAlignTypes = {
|
35
35
|
CENTER: 'center',
|
36
|
-
TOP: 'top'
|
36
|
+
TOP: 'top',
|
37
|
+
UNSET: 'unset'
|
37
38
|
};
|
38
39
|
exports.pictureVerticalAlignTypes = pictureVerticalAlignTypes;
|
39
40
|
var pictureMaskTypes = {
|
40
41
|
ANDROID: 'android',
|
42
|
+
ANDROID_CROPPED: 'android-cropped',
|
41
43
|
NEW_IPHONE: 'new-iphone',
|
42
44
|
BLACK_IPHONE: 'black-iphone',
|
43
45
|
WHITE_IPHONE: 'white-iphone',
|
44
46
|
LAPTOP: 'laptop',
|
45
47
|
IPHONE_12: 'iphone-12',
|
48
|
+
IPHONE_CROPPED: 'iphone-cropped',
|
46
49
|
NONE: 'none'
|
47
50
|
};
|
48
51
|
exports.pictureMaskTypes = pictureMaskTypes;
|
52
|
+
var pictureBackgroundColorTypes = {
|
53
|
+
SPB_SKY_0: 'spbSky0'
|
54
|
+
};
|
55
|
+
exports.pictureBackgroundColorTypes = pictureBackgroundColorTypes;
|
56
|
+
var arrowTheme = {
|
57
|
+
PURPLE: 'purple',
|
58
|
+
DARK: 'dark'
|
59
|
+
};
|
60
|
+
exports.arrowTheme = arrowTheme;
|
49
61
|
var testIdPrefix = 'Instructions';
|
50
62
|
var cn = (0, _uiHelpers.cnCreate)('mfui-instructions');
|
51
63
|
var swiperSlideCn = cn('slide');
|
@@ -63,7 +75,10 @@ var Instructions = function Instructions(_ref) {
|
|
63
75
|
mobileItemTitle = _ref$classes.mobileItemTitle,
|
64
76
|
instructionItemImg = _ref$classes.instructionItemImg,
|
65
77
|
additionalText = _ref$classes.additionalText,
|
66
|
-
|
78
|
+
arrowPrev = _ref$classes.arrowPrev,
|
79
|
+
arrowNext = _ref$classes.arrowNext,
|
80
|
+
_ref$title = _ref.title,
|
81
|
+
title = _ref$title === void 0 ? '' : _ref$title,
|
67
82
|
instructionItems = _ref.instructionItems,
|
68
83
|
_ref$pictureAlign = _ref.pictureAlign,
|
69
84
|
pictureAlign = _ref$pictureAlign === void 0 ? 'left' : _ref$pictureAlign,
|
@@ -71,8 +86,12 @@ var Instructions = function Instructions(_ref) {
|
|
71
86
|
pictureVerticalAlign = _ref$pictureVerticalA === void 0 ? 'center' : _ref$pictureVerticalA,
|
72
87
|
_ref$pictureMask = _ref.pictureMask,
|
73
88
|
pictureMask = _ref$pictureMask === void 0 ? 'none' : _ref$pictureMask,
|
89
|
+
pictureBackgroundColor = _ref.pictureBackgroundColor,
|
74
90
|
getSwiper = _ref.getSwiper,
|
75
91
|
text = _ref.additionalText,
|
92
|
+
showArrows = _ref.showArrows,
|
93
|
+
_ref$arrowsTheme = _ref.arrowsTheme,
|
94
|
+
arrowsTheme = _ref$arrowsTheme === void 0 ? arrowTheme.DARK : _ref$arrowsTheme,
|
76
95
|
children = _ref.children;
|
77
96
|
|
78
97
|
var _React$useState = _react["default"].useState(),
|
@@ -110,6 +129,22 @@ var Instructions = function Instructions(_ref) {
|
|
110
129
|
setSlideIndex(activeIndex);
|
111
130
|
}, []);
|
112
131
|
|
132
|
+
var handlePrevClick = _react["default"].useCallback(function () {
|
133
|
+
if (!swiperInstance) {
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
|
137
|
+
swiperInstance.slidePrev();
|
138
|
+
}, [swiperInstance]);
|
139
|
+
|
140
|
+
var handleNextClick = _react["default"].useCallback(function () {
|
141
|
+
if (!swiperInstance) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
|
145
|
+
swiperInstance.slideNext();
|
146
|
+
}, [swiperInstance]);
|
147
|
+
|
113
148
|
var renderVideo = _react["default"].useCallback(function (mediaUrl, index) {
|
114
149
|
return /*#__PURE__*/_react["default"].createElement("video", (0, _extends2["default"])({
|
115
150
|
loop: true,
|
@@ -157,6 +192,25 @@ var Instructions = function Instructions(_ref) {
|
|
157
192
|
}, (0, _uiHelpers.convert)(title, _uiHelpers.titleConvertConfig));
|
158
193
|
}, [title]);
|
159
194
|
|
195
|
+
var renderQrCode = _react["default"].useCallback(function () {
|
196
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, instructionItems.map(function (_ref4, i) {
|
197
|
+
var qrCode = _ref4.qrCode,
|
198
|
+
qrCodeText = _ref4.qrCodeText;
|
199
|
+
return slideIndex === i && !!qrCode && /*#__PURE__*/_react["default"].createElement(_uiCore.Tile, {
|
200
|
+
className: cn('qr-code'),
|
201
|
+
radius: "rounded",
|
202
|
+
shadowLevel: "default",
|
203
|
+
key: qrCode
|
204
|
+
}, !!qrCodeText && /*#__PURE__*/_react["default"].createElement("div", {
|
205
|
+
className: cn('qr-code-text')
|
206
|
+
}, qrCodeText), /*#__PURE__*/_react["default"].createElement("img", {
|
207
|
+
src: qrCode,
|
208
|
+
className: cn('qr-code-image'),
|
209
|
+
alt: "QR-\u043A\u043E\u0434"
|
210
|
+
}));
|
211
|
+
}));
|
212
|
+
}, [instructionItems, slideIndex]);
|
213
|
+
|
160
214
|
var renderText = _react["default"].useCallback(function () {
|
161
215
|
return /*#__PURE__*/_react["default"].createElement(_uiCore.Paragraph, {
|
162
216
|
className: cn('text', [additionalText]),
|
@@ -184,8 +238,8 @@ var Instructions = function Instructions(_ref) {
|
|
184
238
|
desktop: true
|
185
239
|
}),
|
186
240
|
"data-testid": "".concat(testIdPrefix, "-articles-list-desktop")
|
187
|
-
}, instructionItems.map(function (
|
188
|
-
var itemTitle =
|
241
|
+
}, instructionItems.map(function (_ref5, i) {
|
242
|
+
var itemTitle = _ref5.title;
|
189
243
|
return (
|
190
244
|
/*#__PURE__*/
|
191
245
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
@@ -215,8 +269,8 @@ var Instructions = function Instructions(_ref) {
|
|
215
269
|
"data-testid": "".concat(testIdPrefix, "-articles-list-mobile")
|
216
270
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
217
271
|
className: cn('articles-title-block')
|
218
|
-
}, instructionItems.map(function (
|
219
|
-
var itemTitle =
|
272
|
+
}, instructionItems.map(function (_ref6, i) {
|
273
|
+
var itemTitle = _ref6.title;
|
220
274
|
return slideIndex === i && /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
221
275
|
key: i,
|
222
276
|
"data-index": i
|
@@ -241,6 +295,31 @@ var Instructions = function Instructions(_ref) {
|
|
241
295
|
})));
|
242
296
|
}, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.mobileItemText, getActiveCustomClass, handleArticleClick, instructionItem, instructionItems, mobileInstructionItem, mobileItemTitle, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, slideIndex, text]);
|
243
297
|
|
298
|
+
var renderArrows = _react["default"].useCallback(function () {
|
299
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_uiCore.NavArrow, {
|
300
|
+
dataAttrs: {
|
301
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev
|
302
|
+
},
|
303
|
+
className: cn('arrow', {
|
304
|
+
prev: true
|
305
|
+
}, [arrowPrev]),
|
306
|
+
theme: arrowsTheme,
|
307
|
+
disabled: slideIndex === 0,
|
308
|
+
onClick: handlePrevClick
|
309
|
+
}), /*#__PURE__*/_react["default"].createElement(_uiCore.NavArrow, {
|
310
|
+
dataAttrs: {
|
311
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext
|
312
|
+
},
|
313
|
+
className: cn('arrow', {
|
314
|
+
next: true
|
315
|
+
}, [arrowNext]),
|
316
|
+
view: "next",
|
317
|
+
theme: arrowsTheme,
|
318
|
+
disabled: slideIndex === instructionItems.length - 1,
|
319
|
+
onClick: handleNextClick
|
320
|
+
}));
|
321
|
+
}, [handlePrevClick, handleNextClick, arrowsTheme, arrowPrev, arrowNext, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext, slideIndex, instructionItems.length]);
|
322
|
+
|
244
323
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
245
324
|
className: cn({
|
246
325
|
mask: pictureMask
|
@@ -250,19 +329,21 @@ var Instructions = function Instructions(_ref) {
|
|
250
329
|
hAlign: "center"
|
251
330
|
}, /*#__PURE__*/_react["default"].createElement(_uiCore.GridColumn, {
|
252
331
|
all: "12"
|
253
|
-
}, renderTitle('mobile'), /*#__PURE__*/_react["default"].createElement("div", {
|
254
|
-
className: cn('wrapper'
|
255
|
-
|
332
|
+
}, !!title && renderTitle('mobile'), /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
333
|
+
className: cn('wrapper', {
|
334
|
+
'vertical-align': pictureVerticalAlign
|
335
|
+
})
|
336
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.wrapper)), /*#__PURE__*/_react["default"].createElement("div", {
|
256
337
|
className: cn('picture', {
|
257
338
|
align: pictureAlign,
|
258
|
-
|
339
|
+
background: pictureBackgroundColor
|
259
340
|
}),
|
260
341
|
"data-testid": "".concat(testIdPrefix, "-picture")
|
261
|
-
}, renderPicture()), /*#__PURE__*/_react["default"].createElement("div", {
|
342
|
+
}, renderPicture(), !!showArrows && renderArrows(), renderQrCode()), /*#__PURE__*/_react["default"].createElement("div", {
|
262
343
|
className: cn('articles', {
|
263
344
|
align: pictureAlign
|
264
345
|
})
|
265
|
-
}, renderTitle('desktop'), renderMobileArticles(), renderDesktopArticles(), text && renderText(), children)))));
|
346
|
+
}, !!title && renderTitle('desktop'), renderMobileArticles(), renderDesktopArticles(), text && renderText(), children)))));
|
266
347
|
};
|
267
348
|
|
268
349
|
Instructions.propTypes = {
|
@@ -270,7 +351,10 @@ Instructions.propTypes = {
|
|
270
351
|
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
271
352
|
item: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
272
353
|
image: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
273
|
-
mobileItemText: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
354
|
+
mobileItemText: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
355
|
+
wrapper: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
356
|
+
arrowPrev: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
357
|
+
arrowNext: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
274
358
|
}),
|
275
359
|
rootRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
276
360
|
current: _propTypes["default"].elementType
|
@@ -282,9 +366,11 @@ Instructions.propTypes = {
|
|
282
366
|
activeInstructionItem: _propTypes["default"].string,
|
283
367
|
desktopItemTitle: _propTypes["default"].string,
|
284
368
|
mobileItemTitle: _propTypes["default"].string,
|
285
|
-
instructionItemImg: _propTypes["default"].string
|
369
|
+
instructionItemImg: _propTypes["default"].string,
|
370
|
+
arrowPrev: _propTypes["default"].string,
|
371
|
+
arrowNext: _propTypes["default"].string
|
286
372
|
}),
|
287
|
-
title: _propTypes["default"].string
|
373
|
+
title: _propTypes["default"].string,
|
288
374
|
additionalText: _propTypes["default"].string,
|
289
375
|
instructionItems: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
290
376
|
title: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node, _propTypes["default"].arrayOf(_propTypes["default"].node)]).isRequired,
|
@@ -293,7 +379,11 @@ Instructions.propTypes = {
|
|
293
379
|
imageAlt: _propTypes["default"].string
|
294
380
|
}).isRequired).isRequired,
|
295
381
|
pictureAlign: _propTypes["default"].oneOf([pictureAlignTypes.LEFT, pictureAlignTypes.RIGHT]),
|
382
|
+
pictureVerticalAlign: _propTypes["default"].oneOf([pictureVerticalAlignTypes.CENTER, pictureVerticalAlignTypes.TOP, pictureVerticalAlignTypes.UNSET]),
|
296
383
|
pictureMask: _propTypes["default"].oneOf([pictureMaskTypes.ANDROID, pictureMaskTypes.NEW_IPHONE, pictureMaskTypes.WHITE_IPHONE, pictureMaskTypes.BLACK_IPHONE, pictureMaskTypes.LAPTOP, pictureMaskTypes.IPHONE_12, pictureMaskTypes.NONE]),
|
384
|
+
pictureBackgroundColor: _propTypes["default"].oneOf([pictureBackgroundColorTypes.SPB_SKY_0]),
|
385
|
+
showArrows: _propTypes["default"].bool,
|
386
|
+
arrowsTheme: _propTypes["default"].oneOf([arrowTheme.DARK, arrowTheme.PURPLE]),
|
297
387
|
getSwiper: _propTypes["default"].func
|
298
388
|
};
|
299
389
|
var _default = Instructions;
|
Binary file
|
Binary file
|
@@ -102,11 +102,11 @@ StoreButton.propTypes = {
|
|
102
102
|
onClick: _propTypes["default"].func,
|
103
103
|
className: _propTypes["default"].string,
|
104
104
|
target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
|
105
|
-
sizeAll: _propTypes["default"].oneOf(Object.values(ButtonSizes))
|
106
|
-
sizeWide: _propTypes["default"].oneOf(Object.values(ButtonSizes))
|
107
|
-
sizeDesktop: _propTypes["default"].oneOf(Object.values(ButtonSizes))
|
108
|
-
sizeTablet: _propTypes["default"].oneOf(Object.values(ButtonSizes))
|
109
|
-
sizeMobile: _propTypes["default"].oneOf(Object.values(ButtonSizes))
|
105
|
+
sizeAll: _propTypes["default"].oneOf(Object.values(ButtonSizes)),
|
106
|
+
sizeWide: _propTypes["default"].oneOf(Object.values(ButtonSizes)),
|
107
|
+
sizeDesktop: _propTypes["default"].oneOf(Object.values(ButtonSizes)),
|
108
|
+
sizeTablet: _propTypes["default"].oneOf(Object.values(ButtonSizes)),
|
109
|
+
sizeMobile: _propTypes["default"].oneOf(Object.values(ButtonSizes)),
|
110
110
|
dataAttrs: _propTypes["default"].shape({
|
111
111
|
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
112
112
|
})
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.6.0",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -90,5 +90,5 @@
|
|
90
90
|
"prop-types": "^15.7.2",
|
91
91
|
"swiper": "^6.5.6"
|
92
92
|
},
|
93
|
-
"gitHead": "
|
93
|
+
"gitHead": "0acf2a3cb7f34746afd45a17718da45ecd2bba28"
|
94
94
|
}
|