@doyourjob/gravity-ui-page-constructor 5.31.264 → 5.31.266
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/build/cjs/blocks/Header/Header.css +49 -1
- package/build/cjs/blocks/Header/Header.js +7 -6
- package/build/cjs/blocks/Header/schema.d.ts +8 -0
- package/build/cjs/blocks/Header/schema.js +4 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +4 -0
- package/build/cjs/blocks/LogoRotator/Item.js +1 -2
- package/build/cjs/blocks/LogoRotator/LogoRotator.css +7 -0
- package/build/cjs/blocks/LogoRotator/LogoRotator.js +55 -3
- package/build/cjs/blocks/LogoRotator/schema.d.ts +6 -4
- package/build/cjs/blocks/LogoRotator/schema.js +10 -6
- package/build/cjs/blocks/LogoRotator/utils.d.ts +7 -0
- package/build/cjs/blocks/LogoRotator/utils.js +34 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -2
- package/build/cjs/sub-blocks/MiniCaseCard/MiniCaseCard.css +0 -5
- package/build/esm/blocks/Header/Header.css +49 -1
- package/build/esm/blocks/Header/Header.js +8 -7
- package/build/esm/blocks/Header/schema.d.ts +8 -0
- package/build/esm/blocks/Header/schema.js +5 -1
- package/build/esm/blocks/HeaderSlider/schema.d.ts +4 -0
- package/build/esm/blocks/LogoRotator/Item.js +2 -3
- package/build/esm/blocks/LogoRotator/LogoRotator.css +7 -0
- package/build/esm/blocks/LogoRotator/LogoRotator.js +56 -4
- package/build/esm/blocks/LogoRotator/schema.d.ts +6 -4
- package/build/esm/blocks/LogoRotator/schema.js +10 -6
- package/build/esm/blocks/LogoRotator/utils.d.ts +7 -0
- package/build/esm/blocks/LogoRotator/utils.js +31 -0
- package/build/esm/models/constructor-items/blocks.d.ts +4 -2
- package/build/esm/sub-blocks/MiniCaseCard/MiniCaseCard.css +0 -5
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -2
- package/widget/index.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-header-block__title {
|
|
1
|
+
.pc-header-block__title_size_xl, .pc-header-block__title_size_l, .pc-header-block__title_size_m, .pc-header-block__title_size_s, .pc-header-block__title_size_xs, .pc-header-block__title {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -125,6 +125,54 @@ unpredictable css rules order in build */
|
|
|
125
125
|
--pc-text-header-color: var(--g-color-text-link-hover);
|
|
126
126
|
color: var(--g-color-text-link-hover);
|
|
127
127
|
}
|
|
128
|
+
.pc-header-block__title_size_xs {
|
|
129
|
+
font-size: var(--g-text-body-3-font-size, var(--pc-text-body-3-font-size));
|
|
130
|
+
line-height: var(--g-text-body-3-line-height, var(--pc-text-body-3-line-height));
|
|
131
|
+
color: var(--pc-text-header-color);
|
|
132
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
133
|
+
}
|
|
134
|
+
.pc-header-block__title_size_s {
|
|
135
|
+
font-size: var(--g-text-header-1-font-size, var(--pc-text-header-1-font-size));
|
|
136
|
+
line-height: var(--g-text-header-1-line-height, var(--pc-text-header-1-line-height));
|
|
137
|
+
color: var(--pc-text-header-color);
|
|
138
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
139
|
+
}
|
|
140
|
+
.pc-header-block__title_size_m {
|
|
141
|
+
font-size: var(--g-text-display-2-font-size, var(--pc-text-display-2-font-size));
|
|
142
|
+
line-height: var(--g-text-display-2-line-height, var(--pc-text-display-2-line-height));
|
|
143
|
+
color: var(--pc-text-header-color);
|
|
144
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
145
|
+
}
|
|
146
|
+
@media (max-width: 576px) {
|
|
147
|
+
.pc-header-block__title_size_m {
|
|
148
|
+
font-size: var(--g-text-display-1-font-size, var(--pc-text-display-1-font-size));
|
|
149
|
+
line-height: var(--g-text-display-1-line-height, var(--pc-text-display-1-line-height));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
.pc-header-block__title_size_l {
|
|
153
|
+
font-size: var(--g-text-display-4-font-size, var(--pc-text-display-4-font-size));
|
|
154
|
+
line-height: var(--g-text-display-4-line-height, var(--pc-text-display-4-line-height));
|
|
155
|
+
color: var(--pc-text-header-color);
|
|
156
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
157
|
+
}
|
|
158
|
+
@media (max-width: 577px) {
|
|
159
|
+
.pc-header-block__title_size_l {
|
|
160
|
+
font-size: var(--g-text-display-2-font-size, var(--pc-text-display-2-font-size));
|
|
161
|
+
line-height: var(--g-text-display-2-line-height, var(--pc-text-display-2-line-height));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
.pc-header-block__title_size_xl {
|
|
165
|
+
font-size: var(--g-text-display-5-font-size, var(--pc-text-display-5-font-size));
|
|
166
|
+
line-height: var(--g-text-display-5-line-height, var(--pc-text-display-5-line-height));
|
|
167
|
+
color: var(--pc-text-header-color);
|
|
168
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
169
|
+
}
|
|
170
|
+
@media (max-width: 577px) {
|
|
171
|
+
.pc-header-block__title_size_xl {
|
|
172
|
+
font-size: var(--g-text-display-3-font-size, var(--pc-text-display-3-font-size));
|
|
173
|
+
line-height: var(--g-text-display-3-line-height, var(--pc-text-display-3-line-height));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
128
176
|
.pc-header-block__title_pre-wrap {
|
|
129
177
|
white-space: pre-wrap;
|
|
130
178
|
}
|
|
@@ -30,7 +30,7 @@ const Background = ({ background, isMobile }) => {
|
|
|
30
30
|
const FullWidthBackground = ({ background }) => (react_1.default.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
|
|
31
31
|
// eslint-disable-next-line complexity
|
|
32
32
|
const HeaderBlock = (props) => {
|
|
33
|
-
const { title, switchingTitle, topTags, bottomTags, overtitle, description, buttons, stock, stockPrice, stockShares, image, video, width = 's', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', verticalOffsetTop, verticalOffsetBottom, className, breadcrumbs, status, renderTitle, children, mediaView = 'full', backgroundEffect, headerSpace, backLink, unicorn, unicornSdkUrl, } = props;
|
|
33
|
+
const { title, titleSize = 'l', switchingTitle, topTags, bottomTags, overtitle, description, buttons, stock, stockPrice, stockShares, image, video, width = 's', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', verticalOffsetTop, verticalOffsetBottom, className, breadcrumbs, status, renderTitle, children, mediaView = 'full', backgroundEffect, headerSpace, backLink, unicorn, unicornSdkUrl, } = props;
|
|
34
34
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
35
35
|
const { backButton, blockTag } = (0, react_1.useContext)(headerContext_1.HeaderContext);
|
|
36
36
|
const theme = (0, theme_1.useTheme)();
|
|
@@ -85,12 +85,13 @@ const HeaderBlock = (props) => {
|
|
|
85
85
|
react_1.default.createElement("div", null,
|
|
86
86
|
overtitle && (react_1.default.createElement("div", { className: b('overtitle') },
|
|
87
87
|
react_1.default.createElement(components_1.HTML, null, overtitle))),
|
|
88
|
-
react_1.default.createElement(
|
|
88
|
+
react_1.default.createElement((0, utils_2.getHeaderTag)(titleSize), {
|
|
89
|
+
className: b('title', {
|
|
89
90
|
'pre-wrap': Boolean(switchingTitle),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
size: titleSize,
|
|
92
|
+
}),
|
|
93
|
+
id: titleId,
|
|
94
|
+
}, react_1.default.createElement(HeaderTag_1.default, { tag: blockTag }), status, switchingTitle ? (react_1.default.createElement(SwitchingTtitle_1.default, Object.assign({}, switchingTitle))) : (react_1.default.createElement(react_1.default.Fragment, null, renderTitle ? (renderTitle(title)) : (react_1.default.createElement(components_1.HTML, null, title))))),
|
|
94
95
|
react_1.default.createElement(HeaderDescription_1.default, { className: b('description', { theme: textTheme }), description: description, theme: textTheme }),
|
|
95
96
|
react_1.default.createElement(HeaderButtons_1.default, { buttons: buttons, titleId: titleId }),
|
|
96
97
|
children),
|
|
@@ -323,6 +323,10 @@ export declare const HeaderProperties: {
|
|
|
323
323
|
type: string;
|
|
324
324
|
contentType: string;
|
|
325
325
|
};
|
|
326
|
+
titleSize: {
|
|
327
|
+
type: string;
|
|
328
|
+
enum: string[];
|
|
329
|
+
};
|
|
326
330
|
switchingTitle: {
|
|
327
331
|
type: string;
|
|
328
332
|
additionalProperties: boolean;
|
|
@@ -1041,6 +1045,10 @@ export declare const HeaderBlock: {
|
|
|
1041
1045
|
type: string;
|
|
1042
1046
|
contentType: string;
|
|
1043
1047
|
};
|
|
1048
|
+
titleSize: {
|
|
1049
|
+
type: string;
|
|
1050
|
+
enum: string[];
|
|
1051
|
+
};
|
|
1044
1052
|
switchingTitle: {
|
|
1045
1053
|
type: string;
|
|
1046
1054
|
additionalProperties: boolean;
|
|
@@ -9,7 +9,6 @@ const grid_1 = require("../../grid");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const utils_2 = require("./utils");
|
|
11
11
|
const b = (0, utils_1.block)('logo-rotator-block');
|
|
12
|
-
const defaultColSizes = { all: 3 };
|
|
13
12
|
const getLayerClassName = (layer, swapAnimation, link = false) => `${link ? `${b('item-link')} ` : ''}${b('logo-layer', (0, utils_2.getLayerModifiers)(layer, swapAnimation))}`;
|
|
14
13
|
const Item = ({ url, src, previousSrc, previousUrl, swapAnimation, colSizes, onMouseEnter, onMouseLeave, }) => {
|
|
15
14
|
const renderLayer = (layerSrc, layer, layerUrl) => {
|
|
@@ -20,7 +19,7 @@ const Item = ({ url, src, previousSrc, previousUrl, swapAnimation, colSizes, onM
|
|
|
20
19
|
return react_1.default.createElement("div", { className: getLayerClassName(layer, swapAnimation) }, image);
|
|
21
20
|
};
|
|
22
21
|
const isSwapping = Boolean(previousSrc);
|
|
23
|
-
return (react_1.default.createElement(grid_1.Col, { sizes: colSizes
|
|
22
|
+
return (react_1.default.createElement(grid_1.Col, { sizes: (0, utils_2.getLogoRotatorColSizes)(colSizes) },
|
|
24
23
|
react_1.default.createElement("div", { className: b('item', { swapping: isSwapping }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
|
|
25
24
|
previousSrc && renderLayer(previousSrc, 'from', previousUrl),
|
|
26
25
|
renderLayer(src, previousSrc ? 'to' : 'current', url))));
|
|
@@ -132,6 +132,13 @@ unpredictable css rules order in build */
|
|
|
132
132
|
flex: 1;
|
|
133
133
|
overflow: hidden;
|
|
134
134
|
}
|
|
135
|
+
@media (max-width: 769px) {
|
|
136
|
+
.pc-logo-rotator-block__row-item {
|
|
137
|
+
min-width: 0;
|
|
138
|
+
max-width: calc(50% - 8px);
|
|
139
|
+
flex: 0 0 calc(50% - 8px);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
135
142
|
|
|
136
143
|
@keyframes logo-rotator-fade-out {
|
|
137
144
|
from {
|
|
@@ -15,6 +15,10 @@ const utils_2 = require("./utils");
|
|
|
15
15
|
const b = (0, utils_1.block)('logo-rotator-block');
|
|
16
16
|
const DEFAULT_MIN_ROTATE_COUNT = 2;
|
|
17
17
|
const DEFAULT_MAX_ROTATE_COUNT = 4;
|
|
18
|
+
const GRID_COLUMNS_COUNT = 12;
|
|
19
|
+
const MIN_COLUMN_COUNT = 2;
|
|
20
|
+
const MAX_COLUMN_COUNT = 7;
|
|
21
|
+
const ROW_MODE_ITEM_MIN_WIDTH = 160;
|
|
18
22
|
const emptyTransitions = (count) => Array(count).fill(undefined);
|
|
19
23
|
const pickRandomSlots = (slotIndices, count) => {
|
|
20
24
|
const shuffled = [...slotIndices];
|
|
@@ -24,10 +28,58 @@ const pickRandomSlots = (slotIndices, count) => {
|
|
|
24
28
|
}
|
|
25
29
|
return shuffled.slice(0, count);
|
|
26
30
|
};
|
|
31
|
+
const getFiniteCssValue = (value) => {
|
|
32
|
+
const result = Number.parseFloat(value);
|
|
33
|
+
return Number.isFinite(result) ? result : 0;
|
|
34
|
+
};
|
|
35
|
+
const getSupportedColumnCount = (columns) => {
|
|
36
|
+
const columnCount = Math.min(Math.max(Math.floor(columns), MIN_COLUMN_COUNT), MAX_COLUMN_COUNT);
|
|
37
|
+
return String(columnCount);
|
|
38
|
+
};
|
|
39
|
+
const getActiveGridColumnCount = (colSizes, breakpoint) => {
|
|
40
|
+
const activeColSize = (0, utils_2.getActiveBreakpointValue)((0, utils_2.getLogoRotatorColSizes)(colSizes), breakpoint);
|
|
41
|
+
return getSupportedColumnCount(GRID_COLUMNS_COUNT / activeColSize);
|
|
42
|
+
};
|
|
43
|
+
const getRowModeColumnCount = (width, gap) => {
|
|
44
|
+
const columns = Math.floor((width + gap) / (ROW_MODE_ITEM_MIN_WIDTH + gap));
|
|
45
|
+
return getSupportedColumnCount(columns);
|
|
46
|
+
};
|
|
47
|
+
const getActiveCount = (count, columnCount) => count[columnCount];
|
|
48
|
+
const noop = () => { };
|
|
49
|
+
const useRowModeColumnCount = (rowMode, breakpoint, rowItemsRef) => {
|
|
50
|
+
const [columnCount, setColumnCount] = (0, react_1.useState)(getSupportedColumnCount(MIN_COLUMN_COUNT));
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
if (!rowMode) {
|
|
53
|
+
setColumnCount(getSupportedColumnCount(MIN_COLUMN_COUNT));
|
|
54
|
+
return noop;
|
|
55
|
+
}
|
|
56
|
+
const rowItems = rowItemsRef.current;
|
|
57
|
+
if (!rowItems)
|
|
58
|
+
return noop;
|
|
59
|
+
const updateColumnCount = (width) => {
|
|
60
|
+
const nextColumnCount = breakpoint <= constants_1.BREAKPOINTS.md
|
|
61
|
+
? getSupportedColumnCount(MIN_COLUMN_COUNT)
|
|
62
|
+
: getRowModeColumnCount(width, getFiniteCssValue(window.getComputedStyle(rowItems).columnGap));
|
|
63
|
+
setColumnCount((currentColumnCount) => currentColumnCount === nextColumnCount ? currentColumnCount : nextColumnCount);
|
|
64
|
+
};
|
|
65
|
+
updateColumnCount(rowItems.clientWidth);
|
|
66
|
+
if (typeof ResizeObserver === 'undefined')
|
|
67
|
+
return noop;
|
|
68
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
69
|
+
updateColumnCount(entry.contentRect.width);
|
|
70
|
+
});
|
|
71
|
+
observer.observe(rowItems);
|
|
72
|
+
return () => observer.disconnect();
|
|
73
|
+
}, [breakpoint, rowItemsRef, rowMode]);
|
|
74
|
+
return columnCount;
|
|
75
|
+
};
|
|
27
76
|
const LogoRotatorBlock = (props) => {
|
|
28
|
-
const { animated, title, text, theme, items,
|
|
77
|
+
const { animated, title, text, theme, items, count, minRotateCount = DEFAULT_MIN_ROTATE_COUNT, maxRotateCount = DEFAULT_MAX_ROTATE_COUNT, swapAnimation = utils_2.DEFAULT_SWAP_ANIMATION, colSizes, rowMode, } = props;
|
|
29
78
|
const breakpoint = (0, useWindowBreakpoint_1.default)();
|
|
30
|
-
const
|
|
79
|
+
const rowItemsRef = (0, react_1.useRef)(null);
|
|
80
|
+
const rowModeColumnCount = useRowModeColumnCount(rowMode, breakpoint, rowItemsRef);
|
|
81
|
+
const gridColumnCount = (0, react_1.useMemo)(() => getActiveGridColumnCount(colSizes, breakpoint), [breakpoint, colSizes]);
|
|
82
|
+
const activeCount = getActiveCount(count, rowMode ? rowModeColumnCount : gridColumnCount);
|
|
31
83
|
// Индексы логотипов, которые участвуют в ротации (не статичные)
|
|
32
84
|
const rotatableIndices = (0, react_1.useMemo)(() => items.map((item, i) => (item.isStatic ? -1 : i)).filter((i) => i !== -1), [items]);
|
|
33
85
|
// Инициализация слотов: статичные вставляются в начало, остальные по порядку
|
|
@@ -151,7 +203,7 @@ const LogoRotatorBlock = (props) => {
|
|
|
151
203
|
title || text ? (react_1.default.createElement("div", { className: b('head') },
|
|
152
204
|
title && react_1.default.createElement("h2", { className: b('title') }, title),
|
|
153
205
|
text && react_1.default.createElement("div", { className: b('text') }, text))) : null,
|
|
154
|
-
rowMode ? (react_1.default.createElement("div", { className: b('row-items') }, slots.map((slot, index) => {
|
|
206
|
+
rowMode ? (react_1.default.createElement("div", { className: b('row-items'), ref: rowItemsRef }, slots.map((slot, index) => {
|
|
155
207
|
var _a;
|
|
156
208
|
const transition = transitions[index];
|
|
157
209
|
const item = items[(_a = transition === null || transition === void 0 ? void 0 : transition.to) !== null && _a !== void 0 ? _a : slot];
|
|
@@ -32,11 +32,13 @@ export declare const LogoRotatorBlock: {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
type: string;
|
|
37
|
-
};
|
|
38
|
-
countDesktop: {
|
|
35
|
+
count: {
|
|
39
36
|
type: string;
|
|
37
|
+
additionalProperties: boolean;
|
|
38
|
+
required: string[];
|
|
39
|
+
properties: Record<string, {
|
|
40
|
+
type: 'number';
|
|
41
|
+
}>;
|
|
40
42
|
};
|
|
41
43
|
minRotateCount: {
|
|
42
44
|
type: string;
|
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LogoRotatorBlock = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const countColumns = ['2', '3', '4', '5', '6', '7'];
|
|
6
|
+
const countByColumnsProperties = countColumns.reduce((acc, columns) => (Object.assign(Object.assign({}, acc), { [columns]: { type: 'number' } })), {});
|
|
7
|
+
const countByColumns = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
additionalProperties: false,
|
|
10
|
+
required: countColumns,
|
|
11
|
+
properties: countByColumnsProperties,
|
|
12
|
+
};
|
|
5
13
|
exports.LogoRotatorBlock = {
|
|
6
14
|
'logo-rotator-block': {
|
|
7
15
|
additionalProperties: false,
|
|
8
|
-
required: ['items', '
|
|
16
|
+
required: ['items', 'count'],
|
|
9
17
|
properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.AnimatableProps), { title: {
|
|
10
18
|
type: 'string',
|
|
11
19
|
}, text: {
|
|
@@ -22,11 +30,7 @@ exports.LogoRotatorBlock = {
|
|
|
22
30
|
isStatic: { type: 'boolean' },
|
|
23
31
|
},
|
|
24
32
|
},
|
|
25
|
-
},
|
|
26
|
-
type: 'number',
|
|
27
|
-
}, countDesktop: {
|
|
28
|
-
type: 'number',
|
|
29
|
-
}, minRotateCount: {
|
|
33
|
+
}, count: countByColumns, minRotateCount: {
|
|
30
34
|
type: 'number',
|
|
31
35
|
}, maxRotateCount: {
|
|
32
36
|
type: 'number',
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { GridColumnSize, GridColumnSizesType } from '../../grid';
|
|
1
2
|
import { LogoRotatorBlockProps } from '../../models';
|
|
2
3
|
export type LogoRotatorLayer = 'current' | 'from' | 'to';
|
|
3
4
|
export type LogoRotatorSwapAnimation = NonNullable<LogoRotatorBlockProps['swapAnimation']>;
|
|
4
5
|
export declare const DEFAULT_SWAP_ANIMATION: LogoRotatorSwapAnimation;
|
|
5
6
|
export declare const SWAP_ANIMATION_DURATIONS: Record<LogoRotatorSwapAnimation, number>;
|
|
7
|
+
export declare const getActiveBreakpointValue: <T>(values: Partial<Record<GridColumnSize, T>> & {
|
|
8
|
+
all: T;
|
|
9
|
+
}, breakpoint: number) => T | (undefined & T);
|
|
10
|
+
export declare const getLogoRotatorColSizes: (colSizes: LogoRotatorBlockProps['colSizes']) => GridColumnSizesType & {
|
|
11
|
+
all: number;
|
|
12
|
+
};
|
|
6
13
|
export declare const getLayerModifiers: (layer: LogoRotatorLayer, swapAnimation: LogoRotatorSwapAnimation) => Record<string, boolean>;
|
|
7
14
|
export declare const getInitialSlots: (items: LogoRotatorBlockProps['items'], count: number) => number[];
|
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInitialSlots = exports.getLayerModifiers = exports.SWAP_ANIMATION_DURATIONS = exports.DEFAULT_SWAP_ANIMATION = void 0;
|
|
3
|
+
exports.getInitialSlots = exports.getLayerModifiers = exports.getLogoRotatorColSizes = exports.getActiveBreakpointValue = exports.SWAP_ANIMATION_DURATIONS = exports.DEFAULT_SWAP_ANIMATION = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const grid_1 = require("../../grid");
|
|
4
6
|
exports.DEFAULT_SWAP_ANIMATION = 'fade';
|
|
5
7
|
exports.SWAP_ANIMATION_DURATIONS = {
|
|
6
8
|
fade: 1100,
|
|
7
9
|
morph: 500,
|
|
8
10
|
};
|
|
11
|
+
const defaultColSizes = { all: 3 };
|
|
12
|
+
const maxMobileColSize = 6;
|
|
13
|
+
const gridBreakpoints = [
|
|
14
|
+
[grid_1.GridColumnSize.All, constants_1.BREAKPOINTS.xs],
|
|
15
|
+
[grid_1.GridColumnSize.Sm, constants_1.BREAKPOINTS.sm],
|
|
16
|
+
[grid_1.GridColumnSize.Md, constants_1.BREAKPOINTS.md],
|
|
17
|
+
[grid_1.GridColumnSize.Lg, constants_1.BREAKPOINTS.lg],
|
|
18
|
+
[grid_1.GridColumnSize.Xl, constants_1.BREAKPOINTS.xl],
|
|
19
|
+
];
|
|
20
|
+
const getActiveBreakpointValue = (values, breakpoint) => {
|
|
21
|
+
let result = values.all;
|
|
22
|
+
gridBreakpoints.forEach(([size, minWidth]) => {
|
|
23
|
+
const value = values[size];
|
|
24
|
+
if (breakpoint >= minWidth && value !== undefined) {
|
|
25
|
+
result = value;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
exports.getActiveBreakpointValue = getActiveBreakpointValue;
|
|
31
|
+
const getLogoRotatorColSizes = (colSizes) => {
|
|
32
|
+
const sizes = Object.assign(Object.assign({}, defaultColSizes), colSizes);
|
|
33
|
+
[grid_1.GridColumnSize.All, grid_1.GridColumnSize.Sm].forEach((size) => {
|
|
34
|
+
const colSize = sizes[size];
|
|
35
|
+
if (colSize !== undefined) {
|
|
36
|
+
sizes[size] = Math.min(colSize, maxMobileColSize);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return sizes;
|
|
40
|
+
};
|
|
41
|
+
exports.getLogoRotatorColSizes = getLogoRotatorColSizes;
|
|
9
42
|
const getLayerModifiers = (layer, swapAnimation) => {
|
|
10
43
|
const animationModifier = layer === 'current' ? undefined : `${swapAnimation}-${layer}`;
|
|
11
44
|
const modifiers = { [layer]: true };
|
|
@@ -204,6 +204,7 @@ export interface SwitchingTitleProps {
|
|
|
204
204
|
export type HeaderButtonType = Pick<ButtonProps, 'url' | 'text' | 'img' | 'theme' | 'primary' | 'size' | 'extraProps'>;
|
|
205
205
|
export interface HeaderBlockProps {
|
|
206
206
|
title: string;
|
|
207
|
+
titleSize?: TitleTextSize;
|
|
207
208
|
switchingTitle?: SwitchingTitleProps;
|
|
208
209
|
topTags?: HeaderTag[];
|
|
209
210
|
bottomTags?: HeaderTag[];
|
|
@@ -301,6 +302,8 @@ export interface QuestionBlockItemProps extends QuestionItem {
|
|
|
301
302
|
}
|
|
302
303
|
export interface BannerBlockProps extends BannerCardProps, Animatable {
|
|
303
304
|
}
|
|
305
|
+
export type LogoRotatorColumnCount = '2' | '3' | '4' | '5' | '6' | '7';
|
|
306
|
+
export type LogoRotatorCountConfig = Record<LogoRotatorColumnCount, number>;
|
|
304
307
|
export interface LogoRotatorBlockProps extends Animatable {
|
|
305
308
|
title?: string;
|
|
306
309
|
text?: string;
|
|
@@ -309,8 +312,7 @@ export interface LogoRotatorBlockProps extends Animatable {
|
|
|
309
312
|
src: string;
|
|
310
313
|
isStatic?: boolean;
|
|
311
314
|
}[];
|
|
312
|
-
|
|
313
|
-
countDesktop?: number;
|
|
315
|
+
count: LogoRotatorCountConfig;
|
|
314
316
|
minRotateCount?: number;
|
|
315
317
|
maxRotateCount?: number;
|
|
316
318
|
swapAnimation?: 'fade' | 'morph';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-header-block__title {
|
|
1
|
+
.pc-header-block__title_size_xl, .pc-header-block__title_size_l, .pc-header-block__title_size_m, .pc-header-block__title_size_s, .pc-header-block__title_size_xs, .pc-header-block__title {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -125,6 +125,54 @@ unpredictable css rules order in build */
|
|
|
125
125
|
--pc-text-header-color: var(--g-color-text-link-hover);
|
|
126
126
|
color: var(--g-color-text-link-hover);
|
|
127
127
|
}
|
|
128
|
+
.pc-header-block__title_size_xs {
|
|
129
|
+
font-size: var(--g-text-body-3-font-size, var(--pc-text-body-3-font-size));
|
|
130
|
+
line-height: var(--g-text-body-3-line-height, var(--pc-text-body-3-line-height));
|
|
131
|
+
color: var(--pc-text-header-color);
|
|
132
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
133
|
+
}
|
|
134
|
+
.pc-header-block__title_size_s {
|
|
135
|
+
font-size: var(--g-text-header-1-font-size, var(--pc-text-header-1-font-size));
|
|
136
|
+
line-height: var(--g-text-header-1-line-height, var(--pc-text-header-1-line-height));
|
|
137
|
+
color: var(--pc-text-header-color);
|
|
138
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
139
|
+
}
|
|
140
|
+
.pc-header-block__title_size_m {
|
|
141
|
+
font-size: var(--g-text-display-2-font-size, var(--pc-text-display-2-font-size));
|
|
142
|
+
line-height: var(--g-text-display-2-line-height, var(--pc-text-display-2-line-height));
|
|
143
|
+
color: var(--pc-text-header-color);
|
|
144
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
145
|
+
}
|
|
146
|
+
@media (max-width: 576px) {
|
|
147
|
+
.pc-header-block__title_size_m {
|
|
148
|
+
font-size: var(--g-text-display-1-font-size, var(--pc-text-display-1-font-size));
|
|
149
|
+
line-height: var(--g-text-display-1-line-height, var(--pc-text-display-1-line-height));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
.pc-header-block__title_size_l {
|
|
153
|
+
font-size: var(--g-text-display-4-font-size, var(--pc-text-display-4-font-size));
|
|
154
|
+
line-height: var(--g-text-display-4-line-height, var(--pc-text-display-4-line-height));
|
|
155
|
+
color: var(--pc-text-header-color);
|
|
156
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
157
|
+
}
|
|
158
|
+
@media (max-width: 577px) {
|
|
159
|
+
.pc-header-block__title_size_l {
|
|
160
|
+
font-size: var(--g-text-display-2-font-size, var(--pc-text-display-2-font-size));
|
|
161
|
+
line-height: var(--g-text-display-2-line-height, var(--pc-text-display-2-line-height));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
.pc-header-block__title_size_xl {
|
|
165
|
+
font-size: var(--g-text-display-5-font-size, var(--pc-text-display-5-font-size));
|
|
166
|
+
line-height: var(--g-text-display-5-line-height, var(--pc-text-display-5-line-height));
|
|
167
|
+
color: var(--pc-text-header-color);
|
|
168
|
+
font-weight: var(--g-text-accent-font-weight);
|
|
169
|
+
}
|
|
170
|
+
@media (max-width: 577px) {
|
|
171
|
+
.pc-header-block__title_size_xl {
|
|
172
|
+
font-size: var(--g-text-display-3-font-size, var(--pc-text-display-3-font-size));
|
|
173
|
+
line-height: var(--g-text-display-3-line-height, var(--pc-text-display-3-line-height));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
128
176
|
.pc-header-block__title_pre-wrap {
|
|
129
177
|
white-space: pre-wrap;
|
|
130
178
|
}
|
|
@@ -6,7 +6,7 @@ import { HeaderContext } from '../../context/headerContext';
|
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import { useTheme } from '../../context/theme';
|
|
8
8
|
import { Col, Grid, Row } from '../../grid';
|
|
9
|
-
import { block, getThemedValue } from '../../utils';
|
|
9
|
+
import { block, getHeaderTag, getThemedValue } from '../../utils';
|
|
10
10
|
import BackButton from './BackButton/BackButton';
|
|
11
11
|
import Breadcrumbs from './Breadcrumbs/Breadcrumbs';
|
|
12
12
|
import HeaderButtons from './HeaderButtons/HeaderButtons';
|
|
@@ -27,7 +27,7 @@ const Background = ({ background, isMobile }) => {
|
|
|
27
27
|
const FullWidthBackground = ({ background }) => (React.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
|
|
28
28
|
// eslint-disable-next-line complexity
|
|
29
29
|
export const HeaderBlock = (props) => {
|
|
30
|
-
const { title, switchingTitle, topTags, bottomTags, overtitle, description, buttons, stock, stockPrice, stockShares, image, video, width = 's', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', verticalOffsetTop, verticalOffsetBottom, className, breadcrumbs, status, renderTitle, children, mediaView = 'full', backgroundEffect, headerSpace, backLink, unicorn, unicornSdkUrl, } = props;
|
|
30
|
+
const { title, titleSize = 'l', switchingTitle, topTags, bottomTags, overtitle, description, buttons, stock, stockPrice, stockShares, image, video, width = 's', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', verticalOffsetTop, verticalOffsetBottom, className, breadcrumbs, status, renderTitle, children, mediaView = 'full', backgroundEffect, headerSpace, backLink, unicorn, unicornSdkUrl, } = props;
|
|
31
31
|
const isMobile = useContext(MobileContext);
|
|
32
32
|
const { backButton, blockTag } = useContext(HeaderContext);
|
|
33
33
|
const theme = useTheme();
|
|
@@ -82,12 +82,13 @@ export const HeaderBlock = (props) => {
|
|
|
82
82
|
React.createElement("div", null,
|
|
83
83
|
overtitle && (React.createElement("div", { className: b('overtitle') },
|
|
84
84
|
React.createElement(HTML, null, overtitle))),
|
|
85
|
-
React.createElement(
|
|
85
|
+
React.createElement(getHeaderTag(titleSize), {
|
|
86
|
+
className: b('title', {
|
|
86
87
|
'pre-wrap': Boolean(switchingTitle),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
size: titleSize,
|
|
89
|
+
}),
|
|
90
|
+
id: titleId,
|
|
91
|
+
}, React.createElement(HeaderTag, { tag: blockTag }), status, switchingTitle ? (React.createElement(SwitchingTitle, Object.assign({}, switchingTitle))) : (React.createElement(React.Fragment, null, renderTitle ? (renderTitle(title)) : (React.createElement(HTML, null, title))))),
|
|
91
92
|
React.createElement(HeaderDescription, { className: b('description', { theme: textTheme }), description: description, theme: textTheme }),
|
|
92
93
|
React.createElement(HeaderButtons, { buttons: buttons, titleId: titleId }),
|
|
93
94
|
children),
|
|
@@ -323,6 +323,10 @@ export declare const HeaderProperties: {
|
|
|
323
323
|
type: string;
|
|
324
324
|
contentType: string;
|
|
325
325
|
};
|
|
326
|
+
titleSize: {
|
|
327
|
+
type: string;
|
|
328
|
+
enum: string[];
|
|
329
|
+
};
|
|
326
330
|
switchingTitle: {
|
|
327
331
|
type: string;
|
|
328
332
|
additionalProperties: boolean;
|
|
@@ -1041,6 +1045,10 @@ export declare const HeaderBlock: {
|
|
|
1041
1045
|
type: string;
|
|
1042
1046
|
contentType: string;
|
|
1043
1047
|
};
|
|
1048
|
+
titleSize: {
|
|
1049
|
+
type: string;
|
|
1050
|
+
enum: string[];
|
|
1051
|
+
};
|
|
1044
1052
|
switchingTitle: {
|
|
1045
1053
|
type: string;
|
|
1046
1054
|
additionalProperties: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ImageProps } from '../../components/Image/schema';
|
|
2
2
|
import { HeaderStockType } from '../../models';
|
|
3
|
-
import { BlockBaseProps, ButtonBlock, MediaProps, VideoProps, mediaView, withTheme, } from '../../schema/validators/common';
|
|
3
|
+
import { BlockBaseProps, ButtonBlock, MediaProps, VideoProps, mediaView, titleTextSize, withTheme, } from '../../schema/validators/common';
|
|
4
4
|
import { filteredArray } from '../../schema/validators/utils';
|
|
5
5
|
export const HeaderBackgroundProps = {
|
|
6
6
|
type: 'object',
|
|
@@ -13,6 +13,10 @@ export const HeaderProperties = {
|
|
|
13
13
|
type: 'string',
|
|
14
14
|
contentType: 'text',
|
|
15
15
|
},
|
|
16
|
+
titleSize: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
enum: titleTextSize,
|
|
19
|
+
},
|
|
16
20
|
switchingTitle: {
|
|
17
21
|
type: 'object',
|
|
18
22
|
additionalProperties: false,
|
|
@@ -3,10 +3,9 @@ import { Link } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { Image } from '../../components';
|
|
4
4
|
import { Col } from '../../grid';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
|
-
import { getLayerModifiers } from './utils';
|
|
6
|
+
import { getLayerModifiers, getLogoRotatorColSizes } from './utils';
|
|
7
7
|
import './LogoRotator.css';
|
|
8
8
|
const b = block('logo-rotator-block');
|
|
9
|
-
const defaultColSizes = { all: 3 };
|
|
10
9
|
const getLayerClassName = (layer, swapAnimation, link = false) => `${link ? `${b('item-link')} ` : ''}${b('logo-layer', getLayerModifiers(layer, swapAnimation))}`;
|
|
11
10
|
export const Item = ({ url, src, previousSrc, previousUrl, swapAnimation, colSizes, onMouseEnter, onMouseLeave, }) => {
|
|
12
11
|
const renderLayer = (layerSrc, layer, layerUrl) => {
|
|
@@ -17,7 +16,7 @@ export const Item = ({ url, src, previousSrc, previousUrl, swapAnimation, colSiz
|
|
|
17
16
|
return React.createElement("div", { className: getLayerClassName(layer, swapAnimation) }, image);
|
|
18
17
|
};
|
|
19
18
|
const isSwapping = Boolean(previousSrc);
|
|
20
|
-
return (React.createElement(Col, { sizes: colSizes
|
|
19
|
+
return (React.createElement(Col, { sizes: getLogoRotatorColSizes(colSizes) },
|
|
21
20
|
React.createElement("div", { className: b('item', { swapping: isSwapping }), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
|
|
22
21
|
previousSrc && renderLayer(previousSrc, 'from', previousUrl),
|
|
23
22
|
renderLayer(src, previousSrc ? 'to' : 'current', url))));
|
|
@@ -132,6 +132,13 @@ unpredictable css rules order in build */
|
|
|
132
132
|
flex: 1;
|
|
133
133
|
overflow: hidden;
|
|
134
134
|
}
|
|
135
|
+
@media (max-width: 769px) {
|
|
136
|
+
.pc-logo-rotator-block__row-item {
|
|
137
|
+
min-width: 0;
|
|
138
|
+
max-width: calc(50% - 8px);
|
|
139
|
+
flex: 0 0 calc(50% - 8px);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
135
142
|
|
|
136
143
|
@keyframes logo-rotator-fade-out {
|
|
137
144
|
from {
|