@megafon/ui-shared 6.0.0 → 6.1.1
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 +23 -0
- package/dist/es/components/BlogBox/BlogBox.css +92 -0
- package/dist/es/components/BlogBox/BlogBox.d.ts +28 -0
- package/dist/es/components/BlogBox/BlogBox.js +101 -0
- package/dist/es/components/BlogBox/components/BlogBoxTile.css +197 -0
- package/dist/es/components/BlogBox/components/BlogBoxTile.d.ts +9 -0
- package/dist/es/components/BlogBox/components/BlogBoxTile.js +67 -0
- package/dist/es/components/BlogBox/types.d.ts +37 -0
- package/dist/es/components/BlogBox/types.js +0 -0
- package/dist/es/components/Instructions/Instructions.css +38 -1
- package/dist/es/components/Instructions/Instructions.d.ts +2 -0
- package/dist/es/components/Instructions/Instructions.js +13 -8
- package/dist/es/helpers/getColumnConfig.d.ts +1 -1
- package/dist/es/helpers/setRelAttribute.d.ts +1 -0
- package/dist/es/helpers/setRelAttribute.js +11 -0
- package/dist/es/hooks/useResolutions.d.ts +7 -0
- package/dist/es/hooks/useResolutions.js +60 -0
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/dist/lib/components/BlogBox/BlogBox.css +92 -0
- package/dist/lib/components/BlogBox/BlogBox.d.ts +28 -0
- package/dist/lib/components/BlogBox/BlogBox.js +120 -0
- package/dist/lib/components/BlogBox/components/BlogBoxTile.css +197 -0
- package/dist/lib/components/BlogBox/components/BlogBoxTile.d.ts +9 -0
- package/dist/lib/components/BlogBox/components/BlogBoxTile.js +80 -0
- package/dist/lib/components/BlogBox/types.d.ts +37 -0
- package/dist/lib/components/BlogBox/types.js +1 -0
- package/dist/lib/components/Instructions/Instructions.css +38 -1
- package/dist/lib/components/Instructions/Instructions.d.ts +2 -0
- package/dist/lib/components/Instructions/Instructions.js +13 -8
- package/dist/lib/helpers/getColumnConfig.d.ts +1 -1
- package/dist/lib/helpers/setRelAttribute.d.ts +1 -0
- package/dist/lib/helpers/setRelAttribute.js +20 -0
- package/dist/lib/hooks/useResolutions.d.ts +7 -0
- package/dist/lib/hooks/useResolutions.js +75 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +16 -0
- package/package.json +3 -3
@@ -0,0 +1,60 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
import "core-js/modules/es.array.concat.js";
|
3
|
+
import React from 'react';
|
4
|
+
import { breakpoints } from '@megafon/ui-helpers';
|
5
|
+
var MOBILE_MIDDLE_END = breakpoints.MOBILE_MIDDLE_END,
|
6
|
+
MOBILE_BIG_START = breakpoints.MOBILE_BIG_START,
|
7
|
+
MOBILE_BIG_END = breakpoints.MOBILE_BIG_END,
|
8
|
+
DESKTOP_SMALL_START = breakpoints.DESKTOP_SMALL_START;
|
9
|
+
|
10
|
+
var useResolutions = function useResolutions() {
|
11
|
+
var _React$useState = React.useState(false),
|
12
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
13
|
+
isMobile = _React$useState2[0],
|
14
|
+
setIsMobile = _React$useState2[1];
|
15
|
+
|
16
|
+
var _React$useState3 = React.useState(false),
|
17
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
18
|
+
isTablet = _React$useState4[0],
|
19
|
+
setIsTablet = _React$useState4[1];
|
20
|
+
|
21
|
+
var _React$useState5 = React.useState(false),
|
22
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
23
|
+
isDesktop = _React$useState6[0],
|
24
|
+
setIsDesktop = _React$useState6[1];
|
25
|
+
|
26
|
+
React.useEffect(function () {
|
27
|
+
if (typeof window === 'undefined') {
|
28
|
+
return undefined;
|
29
|
+
}
|
30
|
+
|
31
|
+
var _window = window,
|
32
|
+
matchMedia = _window.matchMedia;
|
33
|
+
var mobileQuery = matchMedia("(max-width: ".concat(MOBILE_MIDDLE_END, "px)"));
|
34
|
+
var tabletQuery = matchMedia("(min-width: ".concat(MOBILE_BIG_START, "px) and (max-width: ").concat(MOBILE_BIG_END, "px)"));
|
35
|
+
var desktopQuery = matchMedia("(min-width: ".concat(DESKTOP_SMALL_START, "px)"));
|
36
|
+
|
37
|
+
var handleResize = function handleResize() {
|
38
|
+
setIsMobile(mobileQuery.matches);
|
39
|
+
setIsTablet(tabletQuery.matches);
|
40
|
+
setIsDesktop(desktopQuery.matches);
|
41
|
+
};
|
42
|
+
|
43
|
+
handleResize();
|
44
|
+
mobileQuery.addEventListener('change', handleResize);
|
45
|
+
tabletQuery.addEventListener('change', handleResize);
|
46
|
+
desktopQuery.addEventListener('change', handleResize);
|
47
|
+
return function () {
|
48
|
+
mobileQuery.removeEventListener('change', handleResize);
|
49
|
+
tabletQuery.removeEventListener('change', handleResize);
|
50
|
+
desktopQuery.removeEventListener('change', handleResize);
|
51
|
+
};
|
52
|
+
}, []);
|
53
|
+
return {
|
54
|
+
isDesktop: isDesktop,
|
55
|
+
isMobile: isMobile,
|
56
|
+
isTablet: isTablet
|
57
|
+
};
|
58
|
+
};
|
59
|
+
|
60
|
+
export default useResolutions;
|
package/dist/es/index.d.ts
CHANGED
@@ -7,6 +7,8 @@ export { default as BannerBox } from './components/BannerBox/BannerBox';
|
|
7
7
|
export { default as BenefitsIcons } from './components/BenefitsIcons/BenefitsIcons';
|
8
8
|
export { default as BenefitsIconsTile } from './components/BenefitsIcons/BenefitsIconsTile';
|
9
9
|
export { default as BenefitsPictures } from './components/BenefitsPictures/BenefitsPictures';
|
10
|
+
export { default as BlogBox } from './components/BlogBox/BlogBox';
|
11
|
+
export { default as BlogBoxTile } from './components/BlogBox/components/BlogBoxTile';
|
10
12
|
export { default as Breadcrumbs } from './components/Breadcrumbs/Breadcrumbs';
|
11
13
|
export { default as BreadcrumbsItem } from './components/Breadcrumbs/components/BreadcrumbsItem';
|
12
14
|
export { default as ButtonBanner } from './components/ButtonBanner/ButtonBanner';
|
package/dist/es/index.js
CHANGED
@@ -7,6 +7,8 @@ export { default as BannerBox } from "./components/BannerBox/BannerBox";
|
|
7
7
|
export { default as BenefitsIcons } from "./components/BenefitsIcons/BenefitsIcons";
|
8
8
|
export { default as BenefitsIconsTile } from "./components/BenefitsIcons/BenefitsIconsTile";
|
9
9
|
export { default as BenefitsPictures } from "./components/BenefitsPictures/BenefitsPictures";
|
10
|
+
export { default as BlogBox } from "./components/BlogBox/BlogBox";
|
11
|
+
export { default as BlogBoxTile } from "./components/BlogBox/components/BlogBoxTile";
|
10
12
|
export { default as Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs";
|
11
13
|
export { default as BreadcrumbsItem } from "./components/Breadcrumbs/components/BreadcrumbsItem";
|
12
14
|
export { default as ButtonBanner } from "./components/ButtonBanner/ButtonBanner";
|
@@ -0,0 +1,92 @@
|
|
1
|
+
h1,
|
2
|
+
h2,
|
3
|
+
h3,
|
4
|
+
h4,
|
5
|
+
h5 {
|
6
|
+
margin: 0;
|
7
|
+
}
|
8
|
+
.mfui-blog-box {
|
9
|
+
display: -webkit-box;
|
10
|
+
display: -ms-flexbox;
|
11
|
+
display: flex;
|
12
|
+
-webkit-box-orient: vertical;
|
13
|
+
-webkit-box-direction: normal;
|
14
|
+
-ms-flex-direction: column;
|
15
|
+
flex-direction: column;
|
16
|
+
-webkit-box-align: center;
|
17
|
+
-ms-flex-align: center;
|
18
|
+
align-items: center;
|
19
|
+
}
|
20
|
+
@media screen and (min-width: 1024px) {
|
21
|
+
.mfui-blog-box__list {
|
22
|
+
display: grid;
|
23
|
+
grid-template-columns: 1fr 1fr;
|
24
|
+
-webkit-column-gap: 20px;
|
25
|
+
-moz-column-gap: 20px;
|
26
|
+
column-gap: 20px;
|
27
|
+
row-gap: 24px;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
.mfui-blog-box__list_row {
|
31
|
+
grid-template-columns: repeat(6, 1fr);
|
32
|
+
}
|
33
|
+
.mfui-blog-box__list_row .mfui-blog-box__item {
|
34
|
+
grid-column-end: span 2;
|
35
|
+
}
|
36
|
+
.mfui-blog-box__list_row-size_1 .mfui-blog-box__item {
|
37
|
+
grid-column-start: 3;
|
38
|
+
}
|
39
|
+
.mfui-blog-box__list_row-size_2 .mfui-blog-box__item:first-child {
|
40
|
+
grid-column-start: 2;
|
41
|
+
}
|
42
|
+
.mfui-blog-box__item_view_thumbnail {
|
43
|
+
margin-top: 16px;
|
44
|
+
}
|
45
|
+
@media screen and (min-width: 1024px) {
|
46
|
+
.mfui-blog-box__item_view_thumbnail {
|
47
|
+
grid-column-start: 1;
|
48
|
+
grid-column-end: 2;
|
49
|
+
margin-top: 0;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
.mfui-blog-box__item_view_full {
|
53
|
+
margin-bottom: 24px;
|
54
|
+
}
|
55
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
56
|
+
.mfui-blog-box__item_view_full {
|
57
|
+
margin-bottom: 32px;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
@media screen and (min-width: 1024px) {
|
61
|
+
.mfui-blog-box__item_view_full {
|
62
|
+
grid-row-start: 1;
|
63
|
+
grid-row-end: 4;
|
64
|
+
grid-column-start: 2;
|
65
|
+
grid-column-end: 3;
|
66
|
+
margin-bottom: 0;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
.mfui-blog-box__button-wrapper {
|
70
|
+
margin-top: 32px;
|
71
|
+
}
|
72
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
73
|
+
.mfui-blog-box__button-wrapper {
|
74
|
+
margin-top: 40px;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
@media screen and (min-width: 1024px) {
|
78
|
+
.mfui-blog-box__button-wrapper {
|
79
|
+
margin-top: 56px;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
.mfui-blog-box__button {
|
83
|
+
min-width: 208px;
|
84
|
+
}
|
85
|
+
.mfui-blog-box_align-left {
|
86
|
+
-webkit-box-align: start;
|
87
|
+
-ms-flex-align: start;
|
88
|
+
align-items: flex-start;
|
89
|
+
}
|
90
|
+
.mfui-blog-box_align-left .mfui-blog-box__item:first-child {
|
91
|
+
grid-column-start: 1;
|
92
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ButtonType, TileDataType } from './types';
|
3
|
+
import './BlogBox.less';
|
4
|
+
export interface IBlogBox {
|
5
|
+
/** Статьи (не более 4, остальные будут проигнорированы) */
|
6
|
+
items: TileDataType[];
|
7
|
+
/** Кнопка */
|
8
|
+
button?: ButtonType;
|
9
|
+
/** Выравнивание по левому краю (при количестве статей менее трех) */
|
10
|
+
hasAlignLeft?: boolean;
|
11
|
+
/** Дополнительный класс для компонента */
|
12
|
+
className?: string;
|
13
|
+
/** Дополнительные классы для внутренних элементов */
|
14
|
+
classes?: {
|
15
|
+
root?: string;
|
16
|
+
item?: string;
|
17
|
+
button?: string;
|
18
|
+
};
|
19
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
20
|
+
dataAttrs?: {
|
21
|
+
root?: Record<string, string>;
|
22
|
+
list?: Record<string, string>;
|
23
|
+
item?: Record<string, string>;
|
24
|
+
button?: Record<string, string>;
|
25
|
+
};
|
26
|
+
}
|
27
|
+
declare const BlogBox: React.FC<IBlogBox>;
|
28
|
+
export default BlogBox;
|
@@ -0,0 +1,120 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
10
|
+
require("core-js/modules/es.array.slice.js");
|
11
|
+
|
12
|
+
require("core-js/modules/es.array.map.js");
|
13
|
+
|
14
|
+
require("core-js/modules/es.array.concat.js");
|
15
|
+
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
17
|
+
|
18
|
+
var _uiCore = require("@megafon/ui-core");
|
19
|
+
|
20
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
21
|
+
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
23
|
+
|
24
|
+
var _useResolutions2 = _interopRequireDefault(require("../../hooks/useResolutions"));
|
25
|
+
|
26
|
+
var _BlogBoxTile = _interopRequireDefault(require("./components/BlogBoxTile"));
|
27
|
+
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
29
|
+
|
30
|
+
var maxItemsCount = 4;
|
31
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-blog-box');
|
32
|
+
|
33
|
+
var BlogBox = function BlogBox(_ref) {
|
34
|
+
var items = _ref.items,
|
35
|
+
button = _ref.button,
|
36
|
+
_ref$hasAlignLeft = _ref.hasAlignLeft,
|
37
|
+
hasAlignLeft = _ref$hasAlignLeft === void 0 ? false : _ref$hasAlignLeft,
|
38
|
+
className = _ref.className,
|
39
|
+
classes = _ref.classes,
|
40
|
+
dataAttrs = _ref.dataAttrs;
|
41
|
+
|
42
|
+
var _useResolutions = (0, _useResolutions2["default"])(),
|
43
|
+
isDesktop = _useResolutions.isDesktop;
|
44
|
+
|
45
|
+
var visibleItems = items.slice(0, maxItemsCount);
|
46
|
+
var itemsCount = visibleItems.length;
|
47
|
+
var isRow = isDesktop && itemsCount < maxItemsCount;
|
48
|
+
var isAlignLeft = isRow && hasAlignLeft;
|
49
|
+
|
50
|
+
var getView = function getView(isCompact, i) {
|
51
|
+
if (isCompact) {
|
52
|
+
return 'compact';
|
53
|
+
}
|
54
|
+
|
55
|
+
if (i === 0) {
|
56
|
+
return 'full';
|
57
|
+
}
|
58
|
+
|
59
|
+
return 'thumbnail';
|
60
|
+
};
|
61
|
+
|
62
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
63
|
+
className: cn({
|
64
|
+
'align-left': isAlignLeft
|
65
|
+
}, [className, classes === null || classes === void 0 ? void 0 : classes.root])
|
66
|
+
}), /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list), {
|
67
|
+
className: cn('list', {
|
68
|
+
row: isRow,
|
69
|
+
'row-size': isRow && "".concat(itemsCount)
|
70
|
+
})
|
71
|
+
}), visibleItems.map(function (item, i) {
|
72
|
+
var view = getView(isRow, i);
|
73
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
|
74
|
+
className: cn('item', {
|
75
|
+
view: view
|
76
|
+
}, [classes === null || classes === void 0 ? void 0 : classes.item]),
|
77
|
+
key: "".concat(item.title, "_").concat(i)
|
78
|
+
}), /*#__PURE__*/_react["default"].createElement(_BlogBoxTile["default"], (0, _extends2["default"])({}, item, {
|
79
|
+
view: view
|
80
|
+
})));
|
81
|
+
})), (button === null || button === void 0 ? void 0 : button.title) && /*#__PURE__*/_react["default"].createElement("div", {
|
82
|
+
className: cn('button-wrapper')
|
83
|
+
}, /*#__PURE__*/_react["default"].createElement(_uiCore.Button, {
|
84
|
+
dataAttrs: {
|
85
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
|
86
|
+
},
|
87
|
+
className: cn('button', [classes === null || classes === void 0 ? void 0 : classes.button]),
|
88
|
+
href: button.href,
|
89
|
+
target: button.target,
|
90
|
+
rel: button.rel
|
91
|
+
}, button.title)));
|
92
|
+
};
|
93
|
+
|
94
|
+
BlogBox.propTypes = {
|
95
|
+
className: _propTypes["default"].string,
|
96
|
+
classes: _propTypes["default"].objectOf(_propTypes["default"].string),
|
97
|
+
dataAttrs: _propTypes["default"].objectOf(_propTypes["default"].object),
|
98
|
+
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
99
|
+
date: _propTypes["default"].string.isRequired,
|
100
|
+
title: _propTypes["default"].string.isRequired,
|
101
|
+
image: _propTypes["default"].shape({
|
102
|
+
srcMobile: _propTypes["default"].string.isRequired,
|
103
|
+
srcDesktop: _propTypes["default"].string.isRequired,
|
104
|
+
srcThumbnail: _propTypes["default"].string.isRequired,
|
105
|
+
alt: _propTypes["default"].string
|
106
|
+
}).isRequired,
|
107
|
+
href: _propTypes["default"].string.isRequired,
|
108
|
+
target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
|
109
|
+
rel: _propTypes["default"].string
|
110
|
+
}).isRequired).isRequired,
|
111
|
+
button: _propTypes["default"].shape({
|
112
|
+
title: _propTypes["default"].string.isRequired,
|
113
|
+
href: _propTypes["default"].string.isRequired,
|
114
|
+
target: _propTypes["default"].oneOf(['_self', '_blank', '_parent', '_top']),
|
115
|
+
rel: _propTypes["default"].string
|
116
|
+
}),
|
117
|
+
hasAlignLeft: _propTypes["default"].bool
|
118
|
+
};
|
119
|
+
var _default = BlogBox;
|
120
|
+
exports["default"] = _default;
|
@@ -0,0 +1,197 @@
|
|
1
|
+
h1,
|
2
|
+
h2,
|
3
|
+
h3,
|
4
|
+
h4,
|
5
|
+
h5 {
|
6
|
+
margin: 0;
|
7
|
+
}
|
8
|
+
.mfui-blog-box-tile {
|
9
|
+
position: relative;
|
10
|
+
display: block;
|
11
|
+
color: var(--content);
|
12
|
+
text-decoration: none;
|
13
|
+
}
|
14
|
+
.mfui-blog-box-tile:hover {
|
15
|
+
text-decoration: none;
|
16
|
+
}
|
17
|
+
.mfui-blog-box-tile:hover .mfui-blog-box-tile__title {
|
18
|
+
color: var(--brandGreen);
|
19
|
+
}
|
20
|
+
.mfui-blog-box-tile__image {
|
21
|
+
width: 100%;
|
22
|
+
height: 100%;
|
23
|
+
border-radius: 24px;
|
24
|
+
-o-object-fit: cover;
|
25
|
+
object-fit: cover;
|
26
|
+
vertical-align: top;
|
27
|
+
}
|
28
|
+
.mfui-blog-box-tile__picture {
|
29
|
+
display: block;
|
30
|
+
}
|
31
|
+
.mfui-blog-box-tile__date {
|
32
|
+
margin-bottom: 4px;
|
33
|
+
color: var(--spbSky3);
|
34
|
+
}
|
35
|
+
.mfui-blog-box-tile__title {
|
36
|
+
/* stylelint-disable-next-line value-no-vendor-prefix */
|
37
|
+
display: -webkit-box;
|
38
|
+
overflow: hidden;
|
39
|
+
white-space: normal;
|
40
|
+
text-overflow: ellipsis;
|
41
|
+
-webkit-box-orient: vertical;
|
42
|
+
-webkit-line-clamp: 4;
|
43
|
+
-webkit-transition: color 0.3s;
|
44
|
+
transition: color 0.3s;
|
45
|
+
}
|
46
|
+
.mfui-blog-box-tile_view_thumbnail {
|
47
|
+
display: -webkit-box;
|
48
|
+
display: -ms-flexbox;
|
49
|
+
display: flex;
|
50
|
+
gap: 20px;
|
51
|
+
}
|
52
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__picture {
|
53
|
+
-ms-flex-negative: 0;
|
54
|
+
flex-shrink: 0;
|
55
|
+
width: 133px;
|
56
|
+
height: 102px;
|
57
|
+
}
|
58
|
+
@media screen and (min-width: 1280px) {
|
59
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__picture {
|
60
|
+
width: 170px;
|
61
|
+
height: 130px;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
@media screen and (min-width: 1440px) {
|
65
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__picture {
|
66
|
+
width: 233px;
|
67
|
+
height: 170px;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__content {
|
71
|
+
-ms-flex-item-align: center;
|
72
|
+
align-self: center;
|
73
|
+
}
|
74
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__date {
|
75
|
+
font-size: 12px;
|
76
|
+
line-height: 18px;
|
77
|
+
}
|
78
|
+
@media screen and (min-width: 1280px) {
|
79
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__date {
|
80
|
+
font-size: 15px;
|
81
|
+
line-height: 24px;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__title {
|
85
|
+
font-weight: 500;
|
86
|
+
font-size: 18px;
|
87
|
+
line-height: 24px;
|
88
|
+
letter-spacing: 0.5px;
|
89
|
+
}
|
90
|
+
@media screen and (min-width: 1280px) {
|
91
|
+
.mfui-blog-box-tile_view_thumbnail .mfui-blog-box-tile__title {
|
92
|
+
font-size: 20px;
|
93
|
+
line-height: 28px;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__picture {
|
97
|
+
height: 358px;
|
98
|
+
}
|
99
|
+
@media screen and (min-width: 1280px) {
|
100
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__picture {
|
101
|
+
height: 438px;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
@media screen and (min-width: 1440px) {
|
105
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__picture {
|
106
|
+
height: 558px;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__content {
|
110
|
+
position: absolute;
|
111
|
+
right: 8px;
|
112
|
+
bottom: 8px;
|
113
|
+
left: 8px;
|
114
|
+
padding: 16px;
|
115
|
+
border-radius: 24px;
|
116
|
+
background-color: var(--base);
|
117
|
+
}
|
118
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
119
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__content {
|
120
|
+
padding: 24px;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
@media screen and (min-width: 768px) {
|
124
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__content {
|
125
|
+
right: 12px;
|
126
|
+
bottom: 12px;
|
127
|
+
left: 12px;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
@media screen and (min-width: 1024px) and (max-width: 1279px) {
|
131
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__content {
|
132
|
+
padding: 16px;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
@media screen and (min-width: 1280px) {
|
136
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__content {
|
137
|
+
padding: 24px;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__title {
|
141
|
+
font-weight: 600;
|
142
|
+
font-size: 22px;
|
143
|
+
line-height: 28px;
|
144
|
+
letter-spacing: 0.5px;
|
145
|
+
}
|
146
|
+
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
147
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__title {
|
148
|
+
font-size: 26px;
|
149
|
+
line-height: 32px;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
@media screen and (min-width: 1024px) {
|
153
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__title {
|
154
|
+
font-size: 28px;
|
155
|
+
line-height: 36px;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
@media screen and (min-width: 1280px) {
|
159
|
+
.mfui-blog-box-tile_view_full .mfui-blog-box-tile__title {
|
160
|
+
font-size: 32px;
|
161
|
+
line-height: 40px;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__picture {
|
165
|
+
height: 233px;
|
166
|
+
}
|
167
|
+
@media screen and (min-width: 1280px) {
|
168
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__picture {
|
169
|
+
height: 288px;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
@media screen and (min-width: 1440px) {
|
173
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__picture {
|
174
|
+
height: 367px;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__content {
|
178
|
+
position: absolute;
|
179
|
+
right: 12px;
|
180
|
+
bottom: 12px;
|
181
|
+
left: 12px;
|
182
|
+
padding: 16px;
|
183
|
+
border-radius: 24px;
|
184
|
+
background-color: var(--base);
|
185
|
+
}
|
186
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__title {
|
187
|
+
font-weight: 500;
|
188
|
+
font-size: 18px;
|
189
|
+
line-height: 24px;
|
190
|
+
letter-spacing: 0.5px;
|
191
|
+
}
|
192
|
+
@media screen and (min-width: 1280px) {
|
193
|
+
.mfui-blog-box-tile_view_compact .mfui-blog-box-tile__title {
|
194
|
+
font-size: 20px;
|
195
|
+
line-height: 28px;
|
196
|
+
}
|
197
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TileDataType, TileViewType } from '../types';
|
3
|
+
import './BlogBoxTile.less';
|
4
|
+
declare type TileSettingsType = {
|
5
|
+
view: TileViewType;
|
6
|
+
};
|
7
|
+
export declare type BlogBoxTileType = TileDataType & TileSettingsType;
|
8
|
+
declare const BlogBoxTile: React.FC<BlogBoxTileType>;
|
9
|
+
export default BlogBoxTile;
|
@@ -0,0 +1,80 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
11
|
+
|
12
|
+
var _setRelAttribute = require("../../../helpers/setRelAttribute");
|
13
|
+
|
14
|
+
var _useResolutions2 = _interopRequireDefault(require("../../../hooks/useResolutions"));
|
15
|
+
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
17
|
+
|
18
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-blog-box-tile');
|
19
|
+
|
20
|
+
var BlogBoxTile = function BlogBoxTile(_ref) {
|
21
|
+
var date = _ref.date,
|
22
|
+
title = _ref.title,
|
23
|
+
href = _ref.href,
|
24
|
+
target = _ref.target,
|
25
|
+
rel = _ref.rel,
|
26
|
+
_ref$image = _ref.image,
|
27
|
+
srcMobile = _ref$image.srcMobile,
|
28
|
+
srcDesktop = _ref$image.srcDesktop,
|
29
|
+
srcThumbnail = _ref$image.srcThumbnail,
|
30
|
+
_ref$image$alt = _ref$image.alt,
|
31
|
+
alt = _ref$image$alt === void 0 ? 'image' : _ref$image$alt,
|
32
|
+
view = _ref.view;
|
33
|
+
|
34
|
+
var _useResolutions = (0, _useResolutions2["default"])(),
|
35
|
+
isMobile = _useResolutions.isMobile;
|
36
|
+
|
37
|
+
var isViewThumbnail = view === 'thumbnail';
|
38
|
+
var currentRel = (0, _setRelAttribute.setRelAttribute)(rel, target);
|
39
|
+
|
40
|
+
var renderImage = function renderImage() {
|
41
|
+
if (isViewThumbnail) {
|
42
|
+
return isMobile ? null : /*#__PURE__*/_react["default"].createElement("picture", {
|
43
|
+
className: cn('picture')
|
44
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
45
|
+
className: cn('image'),
|
46
|
+
src: srcThumbnail,
|
47
|
+
alt: alt
|
48
|
+
}));
|
49
|
+
}
|
50
|
+
|
51
|
+
return /*#__PURE__*/_react["default"].createElement("picture", {
|
52
|
+
className: cn('picture')
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement("source", {
|
54
|
+
media: "(min-width: ".concat(_uiHelpers.breakpoints.DESKTOP_SMALL_START, "px)"),
|
55
|
+
srcSet: srcDesktop
|
56
|
+
}), /*#__PURE__*/_react["default"].createElement("img", {
|
57
|
+
className: cn('image'),
|
58
|
+
src: srcMobile,
|
59
|
+
alt: alt
|
60
|
+
}));
|
61
|
+
};
|
62
|
+
|
63
|
+
return /*#__PURE__*/_react["default"].createElement("a", {
|
64
|
+
className: cn({
|
65
|
+
view: view
|
66
|
+
}),
|
67
|
+
href: href,
|
68
|
+
target: target,
|
69
|
+
rel: currentRel
|
70
|
+
}, renderImage(), /*#__PURE__*/_react["default"].createElement("div", {
|
71
|
+
className: cn('content')
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
73
|
+
className: cn('date')
|
74
|
+
}, date), /*#__PURE__*/_react["default"].createElement("div", {
|
75
|
+
className: cn('title')
|
76
|
+
}, title)));
|
77
|
+
};
|
78
|
+
|
79
|
+
var _default = BlogBoxTile;
|
80
|
+
exports["default"] = _default;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
declare type TargetType = '_self' | '_blank' | '_parent' | '_top';
|
2
|
+
export declare type ButtonType = {
|
3
|
+
/** Название */
|
4
|
+
title: string;
|
5
|
+
/** Ссылка */
|
6
|
+
href: string;
|
7
|
+
/** Атрибут ссылки target */
|
8
|
+
target?: TargetType;
|
9
|
+
/** Атрибут ссылки rel */
|
10
|
+
rel?: string;
|
11
|
+
};
|
12
|
+
export declare type ImageType = {
|
13
|
+
/** Изображение на разрешении экрана 0-1023 */
|
14
|
+
srcMobile: string;
|
15
|
+
/** Изображение на разрешении экрана 1024+ */
|
16
|
+
srcDesktop: string;
|
17
|
+
/** Миниатюра */
|
18
|
+
srcThumbnail: string;
|
19
|
+
/** Значение тега alt для изображения */
|
20
|
+
alt?: string;
|
21
|
+
};
|
22
|
+
export declare type TileDataType = {
|
23
|
+
/** Дата */
|
24
|
+
date: string;
|
25
|
+
/** Заголовок */
|
26
|
+
title: string;
|
27
|
+
/** Изображение */
|
28
|
+
image: ImageType;
|
29
|
+
/** Ссылка */
|
30
|
+
href: string;
|
31
|
+
/** Атрибут ссылки target */
|
32
|
+
target?: TargetType;
|
33
|
+
/** Атрибут ссылки rel */
|
34
|
+
rel?: string;
|
35
|
+
};
|
36
|
+
export declare type TileViewType = 'full' | 'thumbnail' | 'compact';
|
37
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|