@megafon/ui-shared 3.3.5 → 4.0.0-beta.2
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 +16 -15
- package/dist/es/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/es/components/DownloadLinks/DownloadLink.css +1 -1
- package/dist/es/components/Instructions/Instructions.css +0 -3
- package/dist/es/components/Instructions/Instructions.js +1 -3
- package/dist/es/components/PageTitle/PageTitle.css +1 -1
- package/dist/es/components/PictureWithDescription/PictureWithDescription.css +2 -2
- package/dist/es/components/Table/Table.css +6 -1
- package/dist/es/components/VideoBanner/VideoBanner.css +4 -3
- package/dist/es/components/VideoBanner/VideoBanner.d.ts +0 -2
- package/dist/es/components/VideoBanner/VideoBanner.js +33 -20
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/lib/components/DownloadLinks/DownloadLink.css +1 -1
- package/dist/lib/components/Instructions/Instructions.css +0 -3
- package/dist/lib/components/Instructions/Instructions.js +1 -3
- package/dist/lib/components/PageTitle/PageTitle.css +1 -1
- package/dist/lib/components/PictureWithDescription/PictureWithDescription.css +2 -2
- package/dist/lib/components/Table/Table.css +6 -1
- package/dist/lib/components/VideoBanner/VideoBanner.css +4 -3
- package/dist/lib/components/VideoBanner/VideoBanner.d.ts +0 -2
- package/dist/lib/components/VideoBanner/VideoBanner.js +33 -20
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@
|
|
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
|
-
|
6
|
+
# [4.0.0-beta.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.0.0-beta.1...@megafon/ui-shared@4.0.0-beta.2) (2022-06-01)
|
7
7
|
|
8
8
|
**Note:** Version bump only for package @megafon/ui-shared
|
9
9
|
|
@@ -11,35 +11,39 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
|
14
|
+
# [4.0.0-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@4.0.0-beta.0...@megafon/ui-shared@4.0.0-beta.1) (2022-05-27)
|
15
15
|
|
16
|
+
**Note:** Version bump only for package @megafon/ui-shared
|
16
17
|
|
17
|
-
### Bug Fixes
|
18
18
|
|
19
|
-
* **instructions:** remove css prorerty filter for image ([d4ee221](https://github.com/MegafonWebLab/megafon-ui/commit/d4ee22123565b82ec777c1526093a94251e59809))
|
20
|
-
* **picturewithdescription:** fix clearing indents for first and last element ([d9263e3](https://github.com/MegafonWebLab/megafon-ui/commit/d9263e3670b2d493ec4bf194a2cdd6440d1ea86f))
|
21
19
|
|
22
20
|
|
23
21
|
|
22
|
+
# [4.0.0-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.2.3-beta.1...@megafon/ui-shared@4.0.0-beta.0) (2022-05-24)
|
24
23
|
|
25
24
|
|
26
|
-
|
25
|
+
### Bug Fixes
|
27
26
|
|
28
|
-
**
|
27
|
+
* **breadcrumbs:** change default color prop value from black to default ([9c2c0fc](https://github.com/MegafonWebLab/megafon-ui/commit/9c2c0fca7d559a67d3d167b2a8a3c30b420ab7da))
|
29
28
|
|
30
29
|
|
30
|
+
### Features
|
31
31
|
|
32
|
+
* **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ef15841](https://github.com/MegafonWebLab/megafon-ui/commit/ef15841474473739d3ac88da7a8737e183ff288a))
|
32
33
|
|
33
34
|
|
34
|
-
|
35
|
+
### BREAKING CHANGES
|
35
36
|
|
36
|
-
**
|
37
|
+
* **paragraph:** prop 'size' is no longer exists.
|
38
|
+
use component Caption instead of Paragraph size="small"
|
39
|
+
* **breadcrumbs:** color is now depends on current theme. by default it matches content text color.
|
40
|
+
for keep black color on light background use 'black' value for prop 'color'.
|
37
41
|
|
38
42
|
|
39
43
|
|
40
44
|
|
41
45
|
|
42
|
-
## [3.3.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.3.0...@megafon/ui-shared@3.3.1) (2022-
|
46
|
+
## [3.2.3-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.2.3-beta.0...@megafon/ui-shared@3.2.3-beta.1) (2022-05-06)
|
43
47
|
|
44
48
|
**Note:** Version bump only for package @megafon/ui-shared
|
45
49
|
|
@@ -47,12 +51,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
47
51
|
|
48
52
|
|
49
53
|
|
50
|
-
|
51
|
-
|
54
|
+
## [3.2.3-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-shared@3.2.2...@megafon/ui-shared@3.2.3-beta.0) (2022-04-13)
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
* **videobanner:** add proprety for mobile video, use picture for background image ([c21c927](https://github.com/MegafonWebLab/megafon-ui/commit/c21c9278d2ff1e192195a5113d43d50753fd02c5))
|
56
|
+
**Note:** Version bump only for package @megafon/ui-shared
|
56
57
|
|
57
58
|
|
58
59
|
|
@@ -26,7 +26,7 @@ var cn = cnCreate('mfui-breadcrumbs');
|
|
26
26
|
var Breadcrumbs = function Breadcrumbs(_ref) {
|
27
27
|
var items = _ref.items,
|
28
28
|
_ref$color = _ref.color,
|
29
|
-
color = _ref$color === void 0 ? '
|
29
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
30
30
|
className = _ref.className,
|
31
31
|
_ref$classes = _ref.classes,
|
32
32
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
@@ -84,9 +84,7 @@ var Instructions = function Instructions(_ref) {
|
|
84
84
|
muted: true,
|
85
85
|
autoPlay: true,
|
86
86
|
playsInline: true,
|
87
|
-
className: cn('swiper-img'
|
88
|
-
video: true
|
89
|
-
})
|
87
|
+
className: cn('swiper-img')
|
90
88
|
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, index + 1)), /*#__PURE__*/React.createElement("source", {
|
91
89
|
src: mediaUrl,
|
92
90
|
type: "video/mp4"
|
@@ -53,10 +53,10 @@ h5 {
|
|
53
53
|
max-width: 550px;
|
54
54
|
height: 100%;
|
55
55
|
}
|
56
|
-
.mfui-picture-with-description__content
|
56
|
+
.mfui-picture-with-description__content :first-child {
|
57
57
|
margin-top: 0 !important;
|
58
58
|
}
|
59
|
-
.mfui-picture-with-description__content
|
59
|
+
.mfui-picture-with-description__content :last-child {
|
60
60
|
margin-bottom: 0 !important;
|
61
61
|
}
|
62
62
|
@media screen and (min-width: 1024px) {
|
@@ -45,6 +45,7 @@ h5 {
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
.mfui-table__top-shadow {
|
48
|
+
position: -webkit-sticky;
|
48
49
|
position: sticky;
|
49
50
|
top: 0;
|
50
51
|
z-index: 2;
|
@@ -57,6 +58,7 @@ h5 {
|
|
57
58
|
background: linear-gradient(359.94deg, rgba(0, 0, 0, 0.0001) 0.06%, rgba(0, 0, 0, 0.03) 38.08%, rgba(0, 0, 0, 0.08) 74.98%);
|
58
59
|
}
|
59
60
|
.mfui-table__left-shadow {
|
61
|
+
position: -webkit-sticky;
|
60
62
|
position: sticky;
|
61
63
|
top: 0;
|
62
64
|
bottom: 0;
|
@@ -68,6 +70,7 @@ h5 {
|
|
68
70
|
background: linear-gradient(270deg, rgba(0, 0, 0, 0.0001) 16.3%, rgba(0, 0, 0, 0.03) 51.81%, rgba(0, 0, 0, 0.08) 86.27%);
|
69
71
|
}
|
70
72
|
.mfui-table__bottom-gradient {
|
73
|
+
position: -webkit-sticky;
|
71
74
|
position: sticky;
|
72
75
|
bottom: 0;
|
73
76
|
z-index: 1;
|
@@ -81,6 +84,7 @@ h5 {
|
|
81
84
|
background: linear-gradient(to top, var(--base) 25%, rgba(255, 255, 255, 0));
|
82
85
|
}
|
83
86
|
.mfui-table__right-gradient {
|
87
|
+
position: -webkit-sticky;
|
84
88
|
position: sticky;
|
85
89
|
right: 0;
|
86
90
|
z-index: 1;
|
@@ -121,7 +125,7 @@ h5 {
|
|
121
125
|
}
|
122
126
|
.mfui-table__row_head .mfui-table__cell {
|
123
127
|
font-size: 12px;
|
124
|
-
line-height:
|
128
|
+
line-height: 18px;
|
125
129
|
height: 72px;
|
126
130
|
padding-bottom: 12px;
|
127
131
|
color: var(--spbSky3);
|
@@ -138,6 +142,7 @@ h5 {
|
|
138
142
|
min-width: 144px;
|
139
143
|
}
|
140
144
|
.mfui-table_fix-column .mfui-table__cell:first-child {
|
145
|
+
position: -webkit-sticky;
|
141
146
|
position: sticky;
|
142
147
|
}
|
143
148
|
.mfui-table_fix-column .mfui-table__left-shadow {
|
@@ -84,8 +84,9 @@ h5 {
|
|
84
84
|
.mfui-video-banner__background-image {
|
85
85
|
width: 100%;
|
86
86
|
height: 100%;
|
87
|
-
-
|
88
|
-
|
87
|
+
background-repeat: no-repeat;
|
88
|
+
background-position: center;
|
89
|
+
background-size: cover;
|
89
90
|
}
|
90
91
|
.mfui-video-banner__content {
|
91
92
|
position: relative;
|
@@ -190,7 +191,7 @@ h5 {
|
|
190
191
|
}
|
191
192
|
.mfui-video-banner__cost {
|
192
193
|
font-size: 12px;
|
193
|
-
line-height:
|
194
|
+
line-height: 18px;
|
194
195
|
margin-bottom: 18px;
|
195
196
|
}
|
196
197
|
.mfui-video-banner__value {
|
@@ -78,8 +78,6 @@ interface IVideoBannerProps {
|
|
78
78
|
videoSrc?: string;
|
79
79
|
/** Тип видео */
|
80
80
|
videoType?: VideoType;
|
81
|
-
/** Разрешить проигрывать видео на мобильном разрешении */
|
82
|
-
videoMobile?: boolean;
|
83
81
|
/** Наличие звука в видео */
|
84
82
|
isMuted?: boolean;
|
85
83
|
/** Изображение для мобильного разрешения */
|
@@ -63,17 +63,20 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
63
63
|
content = _ref2.content,
|
64
64
|
_ref2$isMuted = _ref2.isMuted,
|
65
65
|
isMuted = _ref2$isMuted === void 0 ? true : _ref2$isMuted,
|
66
|
-
breadcrumbs = _ref2.breadcrumbs
|
67
|
-
_ref2$videoMobile = _ref2.videoMobile,
|
68
|
-
videoMobile = _ref2$videoMobile === void 0 ? false : _ref2$videoMobile;
|
66
|
+
breadcrumbs = _ref2.breadcrumbs;
|
69
67
|
|
70
68
|
var _React$useState = React.useState(true),
|
71
69
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
72
70
|
isMobile = _React$useState2[0],
|
73
71
|
setIsMobile = _React$useState2[1];
|
74
72
|
|
73
|
+
var _React$useState3 = React.useState(imageMobile),
|
74
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
75
|
+
imageSrc = _React$useState4[0],
|
76
|
+
setImageSrc = _React$useState4[1];
|
77
|
+
|
75
78
|
var isVideoData = !!videoSrc && !!videoType;
|
76
|
-
var isRenderVideo =
|
79
|
+
var isRenderVideo = !isMobile && isVideoData;
|
77
80
|
var renderContent = React.useCallback(function (_ref3) {
|
78
81
|
var title = _ref3.title,
|
79
82
|
description = _ref3.description,
|
@@ -186,8 +189,27 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
186
189
|
}
|
187
190
|
}, [videoType, videoSrc, isMuted, classes.video]);
|
188
191
|
React.useEffect(function () {
|
192
|
+
var getImageSrc = function getImageSrc() {
|
193
|
+
var windowWidth = window.innerWidth;
|
194
|
+
|
195
|
+
switch (true) {
|
196
|
+
case windowWidth >= breakpoints.DESKTOP_MIDDLE_START:
|
197
|
+
return imageDesktopWide;
|
198
|
+
|
199
|
+
case windowWidth >= breakpoints.DESKTOP_SMALL_START && windowWidth <= breakpoints.DESKTOP_SMALL_END:
|
200
|
+
return imageDesktop;
|
201
|
+
|
202
|
+
case windowWidth >= breakpoints.MOBILE_BIG_START && windowWidth <= breakpoints.MOBILE_BIG_END:
|
203
|
+
return imageTablet;
|
204
|
+
|
205
|
+
default:
|
206
|
+
return imageMobile;
|
207
|
+
}
|
208
|
+
};
|
209
|
+
|
189
210
|
var resizeHandler = function resizeHandler() {
|
190
211
|
setIsMobile(window.innerWidth < breakpoints.DESKTOP_SMALL_START);
|
212
|
+
setImageSrc(getImageSrc());
|
191
213
|
};
|
192
214
|
|
193
215
|
var resizeHandlerThrottled = throttle(resizeHandler, throttleTime.resize);
|
@@ -196,7 +218,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
196
218
|
return function () {
|
197
219
|
window.removeEventListener('resize', resizeHandlerThrottled);
|
198
220
|
};
|
199
|
-
}, [
|
221
|
+
}, [imageDesktop, imageDesktopWide, imageMobile, imageTablet]);
|
200
222
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
201
223
|
className: cn([className, classes.root]),
|
202
224
|
ref: rootRef
|
@@ -213,20 +235,12 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
213
235
|
classes: {
|
214
236
|
item: classes.breadcrumbs
|
215
237
|
}
|
216
|
-
}), content && renderContent(content), isRenderVideo && renderVideo(), !isRenderVideo && /*#__PURE__*/React.createElement("
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
}), /*#__PURE__*/React.createElement("source", {
|
223
|
-
media: "(min-width: ".concat(breakpoints.MOBILE_BIG_START, "px)"),
|
224
|
-
srcSet: imageTablet
|
225
|
-
}), /*#__PURE__*/React.createElement("img", {
|
226
|
-
className: cn('background-image'),
|
227
|
-
src: imageMobile,
|
228
|
-
alt: ""
|
229
|
-
})))));
|
238
|
+
}), content && renderContent(content), isRenderVideo && renderVideo(), !isRenderVideo && /*#__PURE__*/React.createElement("div", {
|
239
|
+
style: {
|
240
|
+
backgroundImage: "url(".concat(imageSrc, ")")
|
241
|
+
},
|
242
|
+
className: cn('background-image')
|
243
|
+
}))));
|
230
244
|
};
|
231
245
|
|
232
246
|
VideoBanner.propTypes = {
|
@@ -249,7 +263,6 @@ VideoBanner.propTypes = {
|
|
249
263
|
}), PropTypes.any])]),
|
250
264
|
videoSrc: PropTypes.string,
|
251
265
|
videoType: PropTypes.oneOf(Object.values(VideoType)),
|
252
|
-
videoMobile: PropTypes.bool,
|
253
266
|
content: PropTypes.shape({
|
254
267
|
title: PropTypes.string.isRequired,
|
255
268
|
description: PropTypes.string.isRequired,
|
@@ -43,7 +43,7 @@ var cn = (0, _uiHelpers.cnCreate)('mfui-breadcrumbs');
|
|
43
43
|
var Breadcrumbs = function Breadcrumbs(_ref) {
|
44
44
|
var items = _ref.items,
|
45
45
|
_ref$color = _ref.color,
|
46
|
-
color = _ref$color === void 0 ? '
|
46
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
47
47
|
className = _ref.className,
|
48
48
|
_ref$classes = _ref.classes,
|
49
49
|
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
@@ -105,9 +105,7 @@ var Instructions = function Instructions(_ref) {
|
|
105
105
|
muted: true,
|
106
106
|
autoPlay: true,
|
107
107
|
playsInline: true,
|
108
|
-
className: cn('swiper-img'
|
109
|
-
video: true
|
110
|
-
})
|
108
|
+
className: cn('swiper-img')
|
111
109
|
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.image, index + 1)), /*#__PURE__*/_react["default"].createElement("source", {
|
112
110
|
src: mediaUrl,
|
113
111
|
type: "video/mp4"
|
@@ -53,10 +53,10 @@ h5 {
|
|
53
53
|
max-width: 550px;
|
54
54
|
height: 100%;
|
55
55
|
}
|
56
|
-
.mfui-picture-with-description__content
|
56
|
+
.mfui-picture-with-description__content :first-child {
|
57
57
|
margin-top: 0 !important;
|
58
58
|
}
|
59
|
-
.mfui-picture-with-description__content
|
59
|
+
.mfui-picture-with-description__content :last-child {
|
60
60
|
margin-bottom: 0 !important;
|
61
61
|
}
|
62
62
|
@media screen and (min-width: 1024px) {
|
@@ -45,6 +45,7 @@ h5 {
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
.mfui-table__top-shadow {
|
48
|
+
position: -webkit-sticky;
|
48
49
|
position: sticky;
|
49
50
|
top: 0;
|
50
51
|
z-index: 2;
|
@@ -57,6 +58,7 @@ h5 {
|
|
57
58
|
background: linear-gradient(359.94deg, rgba(0, 0, 0, 0.0001) 0.06%, rgba(0, 0, 0, 0.03) 38.08%, rgba(0, 0, 0, 0.08) 74.98%);
|
58
59
|
}
|
59
60
|
.mfui-table__left-shadow {
|
61
|
+
position: -webkit-sticky;
|
60
62
|
position: sticky;
|
61
63
|
top: 0;
|
62
64
|
bottom: 0;
|
@@ -68,6 +70,7 @@ h5 {
|
|
68
70
|
background: linear-gradient(270deg, rgba(0, 0, 0, 0.0001) 16.3%, rgba(0, 0, 0, 0.03) 51.81%, rgba(0, 0, 0, 0.08) 86.27%);
|
69
71
|
}
|
70
72
|
.mfui-table__bottom-gradient {
|
73
|
+
position: -webkit-sticky;
|
71
74
|
position: sticky;
|
72
75
|
bottom: 0;
|
73
76
|
z-index: 1;
|
@@ -81,6 +84,7 @@ h5 {
|
|
81
84
|
background: linear-gradient(to top, var(--base) 25%, rgba(255, 255, 255, 0));
|
82
85
|
}
|
83
86
|
.mfui-table__right-gradient {
|
87
|
+
position: -webkit-sticky;
|
84
88
|
position: sticky;
|
85
89
|
right: 0;
|
86
90
|
z-index: 1;
|
@@ -121,7 +125,7 @@ h5 {
|
|
121
125
|
}
|
122
126
|
.mfui-table__row_head .mfui-table__cell {
|
123
127
|
font-size: 12px;
|
124
|
-
line-height:
|
128
|
+
line-height: 18px;
|
125
129
|
height: 72px;
|
126
130
|
padding-bottom: 12px;
|
127
131
|
color: var(--spbSky3);
|
@@ -138,6 +142,7 @@ h5 {
|
|
138
142
|
min-width: 144px;
|
139
143
|
}
|
140
144
|
.mfui-table_fix-column .mfui-table__cell:first-child {
|
145
|
+
position: -webkit-sticky;
|
141
146
|
position: sticky;
|
142
147
|
}
|
143
148
|
.mfui-table_fix-column .mfui-table__left-shadow {
|
@@ -84,8 +84,9 @@ h5 {
|
|
84
84
|
.mfui-video-banner__background-image {
|
85
85
|
width: 100%;
|
86
86
|
height: 100%;
|
87
|
-
-
|
88
|
-
|
87
|
+
background-repeat: no-repeat;
|
88
|
+
background-position: center;
|
89
|
+
background-size: cover;
|
89
90
|
}
|
90
91
|
.mfui-video-banner__content {
|
91
92
|
position: relative;
|
@@ -190,7 +191,7 @@ h5 {
|
|
190
191
|
}
|
191
192
|
.mfui-video-banner__cost {
|
192
193
|
font-size: 12px;
|
193
|
-
line-height:
|
194
|
+
line-height: 18px;
|
194
195
|
margin-bottom: 18px;
|
195
196
|
}
|
196
197
|
.mfui-video-banner__value {
|
@@ -78,8 +78,6 @@ interface IVideoBannerProps {
|
|
78
78
|
videoSrc?: string;
|
79
79
|
/** Тип видео */
|
80
80
|
videoType?: VideoType;
|
81
|
-
/** Разрешить проигрывать видео на мобильном разрешении */
|
82
|
-
videoMobile?: boolean;
|
83
81
|
/** Наличие звука в видео */
|
84
82
|
isMuted?: boolean;
|
85
83
|
/** Изображение для мобильного разрешения */
|
@@ -95,17 +95,20 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
95
95
|
content = _ref2.content,
|
96
96
|
_ref2$isMuted = _ref2.isMuted,
|
97
97
|
isMuted = _ref2$isMuted === void 0 ? true : _ref2$isMuted,
|
98
|
-
breadcrumbs = _ref2.breadcrumbs
|
99
|
-
_ref2$videoMobile = _ref2.videoMobile,
|
100
|
-
videoMobile = _ref2$videoMobile === void 0 ? false : _ref2$videoMobile;
|
98
|
+
breadcrumbs = _ref2.breadcrumbs;
|
101
99
|
|
102
100
|
var _React$useState = _react["default"].useState(true),
|
103
101
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
104
102
|
isMobile = _React$useState2[0],
|
105
103
|
setIsMobile = _React$useState2[1];
|
106
104
|
|
105
|
+
var _React$useState3 = _react["default"].useState(imageMobile),
|
106
|
+
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
107
|
+
imageSrc = _React$useState4[0],
|
108
|
+
setImageSrc = _React$useState4[1];
|
109
|
+
|
107
110
|
var isVideoData = !!videoSrc && !!videoType;
|
108
|
-
var isRenderVideo =
|
111
|
+
var isRenderVideo = !isMobile && isVideoData;
|
109
112
|
|
110
113
|
var renderContent = _react["default"].useCallback(function (_ref3) {
|
111
114
|
var title = _ref3.title,
|
@@ -221,8 +224,27 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
221
224
|
}, [videoType, videoSrc, isMuted, classes.video]);
|
222
225
|
|
223
226
|
_react["default"].useEffect(function () {
|
227
|
+
var getImageSrc = function getImageSrc() {
|
228
|
+
var windowWidth = window.innerWidth;
|
229
|
+
|
230
|
+
switch (true) {
|
231
|
+
case windowWidth >= _uiHelpers.breakpoints.DESKTOP_MIDDLE_START:
|
232
|
+
return imageDesktopWide;
|
233
|
+
|
234
|
+
case windowWidth >= _uiHelpers.breakpoints.DESKTOP_SMALL_START && windowWidth <= _uiHelpers.breakpoints.DESKTOP_SMALL_END:
|
235
|
+
return imageDesktop;
|
236
|
+
|
237
|
+
case windowWidth >= _uiHelpers.breakpoints.MOBILE_BIG_START && windowWidth <= _uiHelpers.breakpoints.MOBILE_BIG_END:
|
238
|
+
return imageTablet;
|
239
|
+
|
240
|
+
default:
|
241
|
+
return imageMobile;
|
242
|
+
}
|
243
|
+
};
|
244
|
+
|
224
245
|
var resizeHandler = function resizeHandler() {
|
225
246
|
setIsMobile(window.innerWidth < _uiHelpers.breakpoints.DESKTOP_SMALL_START);
|
247
|
+
setImageSrc(getImageSrc());
|
226
248
|
};
|
227
249
|
|
228
250
|
var resizeHandlerThrottled = (0, _lodash["default"])(resizeHandler, _throttleTime["default"].resize);
|
@@ -231,7 +253,7 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
231
253
|
return function () {
|
232
254
|
window.removeEventListener('resize', resizeHandlerThrottled);
|
233
255
|
};
|
234
|
-
}, [
|
256
|
+
}, [imageDesktop, imageDesktopWide, imageMobile, imageTablet]);
|
235
257
|
|
236
258
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
237
259
|
className: cn([className, classes.root]),
|
@@ -249,20 +271,12 @@ var VideoBanner = function VideoBanner(_ref2) {
|
|
249
271
|
classes: {
|
250
272
|
item: classes.breadcrumbs
|
251
273
|
}
|
252
|
-
}), content && renderContent(content), isRenderVideo && renderVideo(), !isRenderVideo && /*#__PURE__*/_react["default"].createElement("
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
}), /*#__PURE__*/_react["default"].createElement("source", {
|
259
|
-
media: "(min-width: ".concat(_uiHelpers.breakpoints.MOBILE_BIG_START, "px)"),
|
260
|
-
srcSet: imageTablet
|
261
|
-
}), /*#__PURE__*/_react["default"].createElement("img", {
|
262
|
-
className: cn('background-image'),
|
263
|
-
src: imageMobile,
|
264
|
-
alt: ""
|
265
|
-
})))));
|
274
|
+
}), content && renderContent(content), isRenderVideo && renderVideo(), !isRenderVideo && /*#__PURE__*/_react["default"].createElement("div", {
|
275
|
+
style: {
|
276
|
+
backgroundImage: "url(".concat(imageSrc, ")")
|
277
|
+
},
|
278
|
+
className: cn('background-image')
|
279
|
+
}))));
|
266
280
|
};
|
267
281
|
|
268
282
|
VideoBanner.propTypes = {
|
@@ -285,7 +299,6 @@ VideoBanner.propTypes = {
|
|
285
299
|
}), PropTypes.any])]),
|
286
300
|
videoSrc: PropTypes.string,
|
287
301
|
videoType: PropTypes.oneOf(Object.values(VideoType)),
|
288
|
-
videoMobile: PropTypes.bool,
|
289
302
|
content: PropTypes.shape({
|
290
303
|
title: PropTypes.string.isRequired,
|
291
304
|
description: PropTypes.string.isRequired,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@megafon/ui-shared",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.0-beta.2",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"@babel/preset-env": "^7.8.6",
|
53
53
|
"@babel/preset-react": "^7.8.3",
|
54
54
|
"@babel/preset-typescript": "^7.8.3",
|
55
|
-
"@megafon/ui-icons": "^
|
55
|
+
"@megafon/ui-icons": "^2.0.0-beta.1",
|
56
56
|
"@svgr/core": "^2.4.1",
|
57
57
|
"@types/enzyme": "^3.10.5",
|
58
58
|
"@types/enzyme-adapter-react-16": "^1.0.6",
|
@@ -82,7 +82,7 @@
|
|
82
82
|
},
|
83
83
|
"dependencies": {
|
84
84
|
"@babel/runtime": "^7.8.4",
|
85
|
-
"@megafon/ui-core": "^
|
85
|
+
"@megafon/ui-core": "^4.0.0-beta.2",
|
86
86
|
"@megafon/ui-helpers": "^2.1.2",
|
87
87
|
"core-js": "^3.6.4",
|
88
88
|
"htmr": "^0.9.2",
|
@@ -90,5 +90,5 @@
|
|
90
90
|
"prop-types": "^15.7.2",
|
91
91
|
"swiper": "^6.5.6"
|
92
92
|
},
|
93
|
-
"gitHead": "
|
93
|
+
"gitHead": "3c75a0fd3d231de9641fd6e2d0cddf4282df02fa"
|
94
94
|
}
|