@doyourjob/gravity-ui-page-constructor-addons 2.1.20 → 2.1.21-dev.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/build/cjs/components/HeaderStripe/CloseIcon.d.ts +2 -0
- package/build/cjs/components/HeaderStripe/CloseIcon.js +9 -0
- package/build/cjs/components/HeaderStripe/HeaderStripe.css +6 -6
- package/build/cjs/components/HeaderStripe/HeaderStripe.d.ts +2 -0
- package/build/cjs/components/HeaderStripe/HeaderStripe.js +14 -3
- package/build/esm/components/HeaderStripe/CloseIcon.d.ts +2 -0
- package/build/esm/components/HeaderStripe/CloseIcon.js +4 -0
- package/build/esm/components/HeaderStripe/HeaderStripe.css +6 -6
- package/build/esm/components/HeaderStripe/HeaderStripe.d.ts +2 -0
- package/build/esm/components/HeaderStripe/HeaderStripe.js +14 -3
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloseIcon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const CloseIcon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" }, props),
|
|
7
|
+
react_1.default.createElement("path", { d: "M15.5838 14.9948L14.9948 15.5838L0 0.589046L0.589046 0L15.5838 14.9948Z", fill: "currentColor" }),
|
|
8
|
+
react_1.default.createElement("path", { d: "M0.000647411 14.9948L0.589693 15.5838L15.5845 0.589046L14.9954 0L0.000647411 14.9948Z", fill: "currentColor" })));
|
|
9
|
+
exports.CloseIcon = CloseIcon;
|
|
@@ -4,7 +4,6 @@ unpredictable css rules order in build */
|
|
|
4
4
|
z-index: calc(var(--pc-addons-navigation-popup-z-index) + 1);
|
|
5
5
|
width: 100%;
|
|
6
6
|
color: var(--g-color-text-brand-contrast);
|
|
7
|
-
background-color: var(--g-color-base-brand);
|
|
8
7
|
overflow: hidden;
|
|
9
8
|
animation: expand-mobile 0.5s ease forwards;
|
|
10
9
|
}
|
|
@@ -38,6 +37,7 @@ unpredictable css rules order in build */
|
|
|
38
37
|
overflow: hidden;
|
|
39
38
|
align-items: center;
|
|
40
39
|
height: 56px;
|
|
40
|
+
border-radius: 12px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.pc-addons-header-stripe__content_with-close {
|
|
@@ -51,7 +51,7 @@ unpredictable css rules order in build */
|
|
|
51
51
|
|
|
52
52
|
@media (min-width: 769px) {
|
|
53
53
|
.pc-addons-header-stripe__content {
|
|
54
|
-
height:
|
|
54
|
+
height: 28px;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
.pc-addons-header-stripe__item {
|
|
@@ -112,14 +112,14 @@ unpredictable css rules order in build */
|
|
|
112
112
|
position: absolute;
|
|
113
113
|
top: 0;
|
|
114
114
|
right: 0;
|
|
115
|
-
|
|
115
|
+
padding: 0 12px;
|
|
116
116
|
height: 100%;
|
|
117
117
|
border: none;
|
|
118
118
|
display: flex;
|
|
119
119
|
align-items: center;
|
|
120
120
|
justify-content: center;
|
|
121
121
|
background: transparent;
|
|
122
|
-
color:
|
|
122
|
+
color: #737373;
|
|
123
123
|
cursor: pointer;
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -148,12 +148,12 @@ unpredictable css rules order in build */
|
|
|
148
148
|
max-height: 0;
|
|
149
149
|
}
|
|
150
150
|
to {
|
|
151
|
-
max-height:
|
|
151
|
+
max-height: 28px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
@keyframes constrict-desktop {
|
|
155
155
|
from {
|
|
156
|
-
max-height:
|
|
156
|
+
max-height: 28px;
|
|
157
157
|
}
|
|
158
158
|
to {
|
|
159
159
|
max-height: 0;
|
|
@@ -4,9 +4,9 @@ exports.HeaderStripe = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const gravity_ui_page_constructor_1 = require("@doyourjob/gravity-ui-page-constructor");
|
|
7
|
-
const icons_1 = require("@gravity-ui/icons");
|
|
8
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
8
|
const cn_1 = require("../../utils/cn");
|
|
9
|
+
const CloseIcon_1 = require("./CloseIcon");
|
|
10
10
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
11
11
|
const b = (0, cn_1.block)('header-stripe');
|
|
12
12
|
const renderItemContent = (item) => {
|
|
@@ -59,10 +59,21 @@ const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroun
|
|
|
59
59
|
}
|
|
60
60
|
return properties;
|
|
61
61
|
}, [textColor, background, backgroundImage]);
|
|
62
|
+
const contentStyle = (0, react_1.useMemo)(() => {
|
|
63
|
+
const item = filteredItems[activeIndex];
|
|
64
|
+
const properties = {};
|
|
65
|
+
if (typeof item === 'object' && item.background) {
|
|
66
|
+
properties.background = item.background;
|
|
67
|
+
}
|
|
68
|
+
if (typeof item === 'object' && item.textColor) {
|
|
69
|
+
properties.color = item.textColor;
|
|
70
|
+
}
|
|
71
|
+
return properties;
|
|
72
|
+
}, [filteredItems, activeIndex]);
|
|
62
73
|
return (react_1.default.createElement("div", { className: b('root', { 'only-desktop': onlyDesktop, closing: isClosing }), style: rootStyle },
|
|
63
74
|
react_1.default.createElement(gravity_ui_page_constructor_1.Grid, null,
|
|
64
75
|
react_1.default.createElement(gravity_ui_page_constructor_1.Col, null,
|
|
65
|
-
react_1.default.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }) },
|
|
76
|
+
react_1.default.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }), style: contentStyle },
|
|
66
77
|
filteredItems.map((item, index) => {
|
|
67
78
|
const isActive = index === activeIndex;
|
|
68
79
|
const isPrev = filteredItems.length > 1 &&
|
|
@@ -77,6 +88,6 @@ const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroun
|
|
|
77
88
|
react_1.default.createElement("div", { className: b('item-content') }, renderItemContent(item))));
|
|
78
89
|
}),
|
|
79
90
|
canClose && (react_1.default.createElement("button", { "aria-label": (0, i18n_1.default)('close'), className: b('close'), onClick: handleClose },
|
|
80
|
-
react_1.default.createElement(uikit_1.Icon, { data:
|
|
91
|
+
react_1.default.createElement(uikit_1.Icon, { data: CloseIcon_1.CloseIcon, className: b('close-icon'), size: 16 }))))))));
|
|
81
92
|
};
|
|
82
93
|
exports.HeaderStripe = HeaderStripe;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const CloseIcon = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" }, props),
|
|
3
|
+
React.createElement("path", { d: "M15.5838 14.9948L14.9948 15.5838L0 0.589046L0.589046 0L15.5838 14.9948Z", fill: "currentColor" }),
|
|
4
|
+
React.createElement("path", { d: "M0.000647411 14.9948L0.589693 15.5838L15.5845 0.589046L14.9954 0L0.000647411 14.9948Z", fill: "currentColor" })));
|
|
@@ -4,7 +4,6 @@ unpredictable css rules order in build */
|
|
|
4
4
|
z-index: calc(var(--pc-addons-navigation-popup-z-index) + 1);
|
|
5
5
|
width: 100%;
|
|
6
6
|
color: var(--g-color-text-brand-contrast);
|
|
7
|
-
background-color: var(--g-color-base-brand);
|
|
8
7
|
overflow: hidden;
|
|
9
8
|
animation: expand-mobile 0.5s ease forwards;
|
|
10
9
|
}
|
|
@@ -38,6 +37,7 @@ unpredictable css rules order in build */
|
|
|
38
37
|
overflow: hidden;
|
|
39
38
|
align-items: center;
|
|
40
39
|
height: 56px;
|
|
40
|
+
border-radius: 12px;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.pc-addons-header-stripe__content_with-close {
|
|
@@ -51,7 +51,7 @@ unpredictable css rules order in build */
|
|
|
51
51
|
|
|
52
52
|
@media (min-width: 769px) {
|
|
53
53
|
.pc-addons-header-stripe__content {
|
|
54
|
-
height:
|
|
54
|
+
height: 28px;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
.pc-addons-header-stripe__item {
|
|
@@ -112,14 +112,14 @@ unpredictable css rules order in build */
|
|
|
112
112
|
position: absolute;
|
|
113
113
|
top: 0;
|
|
114
114
|
right: 0;
|
|
115
|
-
|
|
115
|
+
padding: 0 12px;
|
|
116
116
|
height: 100%;
|
|
117
117
|
border: none;
|
|
118
118
|
display: flex;
|
|
119
119
|
align-items: center;
|
|
120
120
|
justify-content: center;
|
|
121
121
|
background: transparent;
|
|
122
|
-
color:
|
|
122
|
+
color: #737373;
|
|
123
123
|
cursor: pointer;
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -148,12 +148,12 @@ unpredictable css rules order in build */
|
|
|
148
148
|
max-height: 0;
|
|
149
149
|
}
|
|
150
150
|
to {
|
|
151
|
-
max-height:
|
|
151
|
+
max-height: 28px;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
@keyframes constrict-desktop {
|
|
155
155
|
from {
|
|
156
|
-
max-height:
|
|
156
|
+
max-height: 28px;
|
|
157
157
|
}
|
|
158
158
|
to {
|
|
159
159
|
max-height: 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { Col, Grid } from '@doyourjob/gravity-ui-page-constructor';
|
|
3
|
-
import { Xmark } from '@gravity-ui/icons';
|
|
4
3
|
import { Icon, useMobile } from '@gravity-ui/uikit';
|
|
5
4
|
import { block } from '../../utils/cn';
|
|
5
|
+
import { CloseIcon } from './CloseIcon';
|
|
6
6
|
import i18n from './i18n';
|
|
7
7
|
import './HeaderStripe.css';
|
|
8
8
|
const b = block('header-stripe');
|
|
@@ -56,10 +56,21 @@ export const HeaderStripe = ({ duration = 8000, items, textColor, background, ba
|
|
|
56
56
|
}
|
|
57
57
|
return properties;
|
|
58
58
|
}, [textColor, background, backgroundImage]);
|
|
59
|
+
const contentStyle = useMemo(() => {
|
|
60
|
+
const item = filteredItems[activeIndex];
|
|
61
|
+
const properties = {};
|
|
62
|
+
if (typeof item === 'object' && item.background) {
|
|
63
|
+
properties.background = item.background;
|
|
64
|
+
}
|
|
65
|
+
if (typeof item === 'object' && item.textColor) {
|
|
66
|
+
properties.color = item.textColor;
|
|
67
|
+
}
|
|
68
|
+
return properties;
|
|
69
|
+
}, [filteredItems, activeIndex]);
|
|
59
70
|
return (React.createElement("div", { className: b('root', { 'only-desktop': onlyDesktop, closing: isClosing }), style: rootStyle },
|
|
60
71
|
React.createElement(Grid, null,
|
|
61
72
|
React.createElement(Col, null,
|
|
62
|
-
React.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }) },
|
|
73
|
+
React.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }), style: contentStyle },
|
|
63
74
|
filteredItems.map((item, index) => {
|
|
64
75
|
const isActive = index === activeIndex;
|
|
65
76
|
const isPrev = filteredItems.length > 1 &&
|
|
@@ -74,5 +85,5 @@ export const HeaderStripe = ({ duration = 8000, items, textColor, background, ba
|
|
|
74
85
|
React.createElement("div", { className: b('item-content') }, renderItemContent(item))));
|
|
75
86
|
}),
|
|
76
87
|
canClose && (React.createElement("button", { "aria-label": i18n('close'), className: b('close'), onClick: handleClose },
|
|
77
|
-
React.createElement(Icon, { data:
|
|
88
|
+
React.createElement(Icon, { data: CloseIcon, className: b('close-icon'), size: 16 }))))))));
|
|
78
89
|
};
|