@gravity-ui/page-constructor 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/build/cjs/blocks/Companies/Companies.js +2 -6
- package/build/cjs/blocks/ContentLayout/schema.js +2 -1
- package/build/cjs/blocks/Header/Header.css +11 -10
- package/build/cjs/blocks/Header/Header.js +15 -15
- package/build/cjs/blocks/Header/schema.d.ts +332 -230
- package/build/cjs/blocks/Header/schema.js +6 -20
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/cjs/blocks/Tabs/Tabs.js +3 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/cjs/components/Image/Image.d.ts +2 -4
- package/build/cjs/components/Image/Image.js +16 -6
- package/build/cjs/components/Image/schema.d.ts +56 -0
- package/build/cjs/components/Image/schema.js +54 -0
- package/build/cjs/components/Media/Image/Image.js +3 -3
- package/build/cjs/components/Media/Image/utils.d.ts +2 -2
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
- package/build/cjs/models/constructor-items/common.d.ts +11 -7
- package/build/cjs/models/guards.d.ts +2 -3
- package/build/cjs/models/guards.js +1 -5
- package/build/cjs/schema/validators/common.d.ts +0 -31
- package/build/cjs/schema/validators/common.js +5 -32
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
- package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
- package/build/cjs/sub-blocks/Partner/schema.js +2 -1
- package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
- package/build/cjs/sub-blocks/Quote/schema.js +4 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
- package/build/esm/blocks/Companies/Companies.js +2 -6
- package/build/esm/blocks/ContentLayout/schema.js +2 -1
- package/build/esm/blocks/Header/Header.css +11 -10
- package/build/esm/blocks/Header/Header.js +16 -16
- package/build/esm/blocks/Header/schema.d.ts +332 -230
- package/build/esm/blocks/Header/schema.js +5 -19
- package/build/esm/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/esm/blocks/Tabs/Tabs.js +3 -2
- package/build/esm/blocks/Tabs/schema.js +2 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/esm/components/Image/Image.d.ts +2 -4
- package/build/esm/components/Image/Image.js +17 -7
- package/build/esm/components/Image/schema.d.ts +56 -0
- package/build/esm/components/Image/schema.js +51 -0
- package/build/esm/components/Media/Image/Image.js +3 -3
- package/build/esm/components/Media/Image/utils.d.ts +2 -2
- package/build/esm/models/constructor-items/blocks.d.ts +4 -8
- package/build/esm/models/constructor-items/common.d.ts +11 -7
- package/build/esm/models/guards.d.ts +2 -3
- package/build/esm/models/guards.js +0 -3
- package/build/esm/schema/validators/common.d.ts +0 -31
- package/build/esm/schema/validators/common.js +1 -28
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
- package/build/esm/sub-blocks/Partner/Partner.js +1 -1
- package/build/esm/sub-blocks/Partner/schema.js +2 -1
- package/build/esm/sub-blocks/Quote/Quote.js +3 -2
- package/build/esm/sub-blocks/Quote/schema.js +2 -1
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -8
- package/server/models/constructor-items/common.d.ts +11 -7
- package/server/models/guards.d.ts +2 -3
- package/server/models/guards.js +1 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isNewMetrikaFormat = exports.isBlock = void 0;
|
|
4
4
|
const _1 = require("./");
|
|
5
5
|
function isBlock(block) {
|
|
6
6
|
return block.type in _1.BlockTypes;
|
|
@@ -10,7 +10,3 @@ function isNewMetrikaFormat(metrika) {
|
|
|
10
10
|
return Boolean(Array.isArray(metrika) && metrika.length && typeof metrika[0] === 'object');
|
|
11
11
|
}
|
|
12
12
|
exports.isNewMetrikaFormat = isNewMetrikaFormat;
|
|
13
|
-
function headerHasMediaBackground(background) {
|
|
14
|
-
return 'image' in background || 'video' in background || 'youtube' in background;
|
|
15
|
-
}
|
|
16
|
-
exports.headerHasMediaBackground = headerHasMediaBackground;
|
|
@@ -19,7 +19,6 @@ export declare const sizeNumber: {
|
|
|
19
19
|
minimum: number;
|
|
20
20
|
};
|
|
21
21
|
export declare const contentThemes: string[];
|
|
22
|
-
export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
|
|
23
22
|
export declare const BaseProps: {
|
|
24
23
|
type: {};
|
|
25
24
|
when: {};
|
|
@@ -159,36 +158,6 @@ export declare const JustifyProps: {
|
|
|
159
158
|
type: string;
|
|
160
159
|
enum: string[];
|
|
161
160
|
};
|
|
162
|
-
export declare const ImageObjectProps: {
|
|
163
|
-
type: string;
|
|
164
|
-
additionalProperties: boolean;
|
|
165
|
-
required: string[];
|
|
166
|
-
properties: {
|
|
167
|
-
src: {
|
|
168
|
-
type: string;
|
|
169
|
-
pattern: string;
|
|
170
|
-
};
|
|
171
|
-
alt: {
|
|
172
|
-
type: string;
|
|
173
|
-
};
|
|
174
|
-
disableCompress: {
|
|
175
|
-
type: string;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
export declare const ImageProps: {
|
|
180
|
-
oneOf: ({
|
|
181
|
-
type: string;
|
|
182
|
-
properties: {
|
|
183
|
-
when: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
type: string;
|
|
189
|
-
pattern: string;
|
|
190
|
-
})[];
|
|
191
|
-
};
|
|
192
161
|
export declare const DataLensObjectProps: {
|
|
193
162
|
type: string;
|
|
194
163
|
additionalProperties: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.
|
|
4
|
-
const utils_1 = require("./utils");
|
|
3
|
+
exports.MediaProps = exports.ButtonBlock = exports.TitleProps = exports.BlockBaseProps = exports.AnchorProps = exports.withTheme = exports.MenuProps = exports.ButtonProps = exports.authorItem = exports.FileLinkProps = exports.LinkProps = exports.BackgroundProps = exports.DataLensProps = exports.DataLensObjectProps = exports.JustifyProps = exports.ThemeProps = exports.VideoProps = exports.PlayIconProps = exports.LoopProps = exports.ChildrenCardsProps = exports.ChildrenProps = exports.AnimatableProps = exports.sliderSizesObject = exports.containerSizesObject = exports.BaseProps = exports.contentThemes = exports.sizeNumber = exports.dividerEnum = exports.fileLinkTypes = exports.videoControlsTypes = exports.playIconThemes = exports.playIconTypes = exports.videoTypes = exports.contentTextWidth = exports.contentSizes = exports.sliderSizesArray = exports.containerSizesArray = exports.textSize = exports.mediaDirection = void 0;
|
|
5
4
|
const pixel_1 = require("./pixel");
|
|
6
5
|
const models_1 = require("../../models");
|
|
6
|
+
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
exports.mediaDirection = ['media-content', 'content-media'];
|
|
8
8
|
exports.textSize = ['s', 'm', 'l'];
|
|
9
9
|
exports.containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -18,7 +18,6 @@ exports.fileLinkTypes = ['vertical', 'horizontal'];
|
|
|
18
18
|
exports.dividerEnum = { enum: [0, 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'] };
|
|
19
19
|
exports.sizeNumber = { type: 'number', maximum: 12, minimum: 1 };
|
|
20
20
|
exports.contentThemes = ['default', 'dark', 'light'];
|
|
21
|
-
exports.urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
|
|
22
21
|
exports.BaseProps = {
|
|
23
22
|
type: {},
|
|
24
23
|
when: {},
|
|
@@ -130,32 +129,6 @@ exports.JustifyProps = {
|
|
|
130
129
|
type: 'string',
|
|
131
130
|
enum: ['start', 'center', 'end'],
|
|
132
131
|
};
|
|
133
|
-
exports.ImageObjectProps = {
|
|
134
|
-
type: 'object',
|
|
135
|
-
additionalProperties: false,
|
|
136
|
-
required: ['src'],
|
|
137
|
-
properties: {
|
|
138
|
-
src: {
|
|
139
|
-
type: 'string',
|
|
140
|
-
pattern: exports.urlPattern,
|
|
141
|
-
},
|
|
142
|
-
alt: {
|
|
143
|
-
type: 'string',
|
|
144
|
-
},
|
|
145
|
-
disableCompress: {
|
|
146
|
-
type: 'boolean',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
exports.ImageProps = {
|
|
151
|
-
oneOf: [
|
|
152
|
-
{
|
|
153
|
-
type: 'string',
|
|
154
|
-
pattern: exports.urlPattern,
|
|
155
|
-
},
|
|
156
|
-
(0, utils_1.filteredItem)(Object.assign({}, exports.ImageObjectProps)),
|
|
157
|
-
],
|
|
158
|
-
};
|
|
159
132
|
exports.DataLensObjectProps = {
|
|
160
133
|
type: 'object',
|
|
161
134
|
additionalProperties: false,
|
|
@@ -172,7 +145,7 @@ exports.DataLensProps = {
|
|
|
172
145
|
};
|
|
173
146
|
exports.BackgroundProps = {
|
|
174
147
|
additionalProperties: false,
|
|
175
|
-
properties: Object.assign(Object.assign({}, exports.AnimatableProps), { image:
|
|
148
|
+
properties: Object.assign(Object.assign({}, exports.AnimatableProps), { image: schema_1.ImageProps, color: {
|
|
176
149
|
type: 'string',
|
|
177
150
|
}, video: exports.VideoProps, height: {
|
|
178
151
|
type: 'number',
|
|
@@ -241,7 +214,7 @@ exports.authorItem = {
|
|
|
241
214
|
},
|
|
242
215
|
avatar: {
|
|
243
216
|
type: 'string',
|
|
244
|
-
pattern:
|
|
217
|
+
pattern: schema_1.urlPattern,
|
|
245
218
|
},
|
|
246
219
|
description: {
|
|
247
220
|
type: 'string',
|
|
@@ -441,7 +414,7 @@ exports.MediaProps = {
|
|
|
441
414
|
type: 'string',
|
|
442
415
|
},
|
|
443
416
|
image: {
|
|
444
|
-
anyOf: [
|
|
417
|
+
anyOf: [schema_1.ImageProps, { type: 'array', items: schema_1.ImageProps }],
|
|
445
418
|
},
|
|
446
419
|
video: exports.VideoProps,
|
|
447
420
|
youtube: {
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("../../schema/validators/common");
|
|
6
6
|
const schema_1 = require("../../components/CardBase/schema");
|
|
7
7
|
const schema_2 = require("../Content/schema");
|
|
8
|
+
const schema_3 = require("../../components/Image/schema");
|
|
8
9
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
9
10
|
const BackgroundCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size']);
|
|
10
11
|
exports.BackgroundCard = {
|
|
@@ -13,7 +14,7 @@ exports.BackgroundCard = {
|
|
|
13
14
|
required: ['title', 'text'],
|
|
14
15
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), schema_1.CardBase), BackgroundCardContentProps), { url: {
|
|
15
16
|
type: 'string',
|
|
16
|
-
}, background: (0, common_1.withTheme)(
|
|
17
|
+
}, background: (0, common_1.withTheme)(schema_3.ImageObjectProps), backgroundColor: {
|
|
17
18
|
type: 'string',
|
|
18
19
|
}, paddingBottom: {
|
|
19
20
|
type: 'string',
|
|
@@ -13,7 +13,7 @@ const BasicCard = (props) => {
|
|
|
13
13
|
const iconProps = icon && (0, utils_2.getMediaImage)(icon);
|
|
14
14
|
return (react_1.default.createElement(CardBase_1.default, { className: b(), url: url, border: border },
|
|
15
15
|
react_1.default.createElement(CardBase_1.default.Content, null,
|
|
16
|
-
iconProps &&
|
|
16
|
+
iconProps && react_1.default.createElement(Image_1.default, Object.assign({}, iconProps, { className: b('icon') })),
|
|
17
17
|
react_1.default.createElement(__1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
|
|
18
18
|
};
|
|
19
19
|
exports.default = BasicCard;
|
|
@@ -6,6 +6,7 @@ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
7
|
const schema_1 = require("../../components/CardBase/schema");
|
|
8
8
|
const schema_2 = require("../Content/schema");
|
|
9
|
+
const schema_3 = require("../../components/Image/schema");
|
|
9
10
|
const BasicCardContentProps = lodash_1.default.omit(schema_2.ContentBase, ['size', 'theme']);
|
|
10
11
|
exports.BasicCard = {
|
|
11
12
|
'basic-card': {
|
|
@@ -13,6 +14,6 @@ exports.BasicCard = {
|
|
|
13
14
|
required: ['url'],
|
|
14
15
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), schema_1.CardBase), BasicCardContentProps), { url: {
|
|
15
16
|
type: 'string',
|
|
16
|
-
}, icon:
|
|
17
|
+
}, icon: schema_3.ImageProps }),
|
|
17
18
|
},
|
|
18
19
|
};
|
|
@@ -9,7 +9,7 @@ const Partner = ({ text, logo, url, border }) => {
|
|
|
9
9
|
const logoData = typeof logo === 'string' ? { src: logo } : logo;
|
|
10
10
|
return (react_1.default.createElement(components_1.CardBase, { url: url, target: "_blank", className: b(), border: border },
|
|
11
11
|
react_1.default.createElement(components_1.CardBase.Content, null,
|
|
12
|
-
react_1.default.createElement(components_1.Image, { className: b('logo')
|
|
12
|
+
react_1.default.createElement(components_1.Image, Object.assign({ className: b('logo') }, logoData)),
|
|
13
13
|
react_1.default.createElement(components_1.HTML, null, text))));
|
|
14
14
|
};
|
|
15
15
|
exports.default = Partner;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PartnerBlock = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.PartnerBlock = {
|
|
6
7
|
partner: {
|
|
7
8
|
additionalProperties: false,
|
|
8
9
|
required: ['text', 'logo', 'url'],
|
|
9
10
|
properties: Object.assign(Object.assign({}, common_1.BaseProps), { text: {
|
|
10
11
|
type: 'string',
|
|
11
|
-
}, logo:
|
|
12
|
+
}, logo: schema_1.ImageProps, url: {
|
|
12
13
|
type: 'string',
|
|
13
14
|
} }),
|
|
14
15
|
},
|
|
@@ -7,12 +7,13 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const models_1 = require("../../models");
|
|
8
8
|
const components_1 = require("../../components");
|
|
9
9
|
const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
10
|
+
const utils_2 = require("../../components/Media/Image/utils");
|
|
10
11
|
const b = (0, utils_1.block)('quote');
|
|
11
12
|
const Quote = (props) => {
|
|
12
13
|
const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
|
|
13
14
|
const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
|
|
14
15
|
const imageThemed = (0, utils_1.getThemedValue)(image, theme);
|
|
15
|
-
const imageData =
|
|
16
|
+
const imageData = (0, utils_2.getMediaImage)(imageThemed);
|
|
16
17
|
const renderFooter = Boolean(author || url) && (react_1.default.createElement("div", { className: b('author-wrapper') },
|
|
17
18
|
author && (react_1.default.createElement(components_1.Author, { className: b('author', { theme: textTheme }), author: author, type: models_1.AuthorType.Line })),
|
|
18
19
|
url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }) }, buttonText))));
|
|
@@ -25,6 +26,6 @@ const Quote = (props) => {
|
|
|
25
26
|
react_1.default.createElement(components_1.HTML, null, text)))),
|
|
26
27
|
renderFooter),
|
|
27
28
|
react_1.default.createElement("div", { className: b('image-wrapper') },
|
|
28
|
-
react_1.default.createElement(components_1.Image, {
|
|
29
|
+
react_1.default.createElement(components_1.Image, Object.assign({}, imageData, { className: b('image') })))));
|
|
29
30
|
};
|
|
30
31
|
exports.default = Quote;
|
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Quote = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.Quote = {
|
|
6
7
|
quote: {
|
|
7
8
|
additionalProperties: false,
|
|
8
9
|
required: ['text', 'image', 'logo'],
|
|
9
10
|
properties: Object.assign(Object.assign({}, common_1.BaseProps), { text: {
|
|
10
11
|
type: 'string',
|
|
11
|
-
}, image: (0, common_1.withTheme)(
|
|
12
|
+
}, image: (0, common_1.withTheme)(schema_1.ImageProps), logo: {
|
|
12
13
|
type: 'string',
|
|
13
|
-
pattern:
|
|
14
|
+
pattern: schema_1.urlPattern,
|
|
14
15
|
}, color: {
|
|
15
16
|
type: 'string',
|
|
16
17
|
}, url: {
|
|
17
18
|
type: 'string',
|
|
18
|
-
pattern:
|
|
19
|
+
pattern: schema_1.urlPattern,
|
|
19
20
|
}, theme: common_1.ThemeProps, author: common_1.authorItem }),
|
|
20
21
|
},
|
|
21
22
|
};
|
|
@@ -8,8 +8,8 @@ const components_1 = require("../../components/");
|
|
|
8
8
|
const utils_2 = require("../../components/Media/Image/utils");
|
|
9
9
|
const b = (0, utils_1.block)('tutorial-card');
|
|
10
10
|
function iconElement(icon, title) {
|
|
11
|
-
const
|
|
12
|
-
return react_1.default.createElement(components_1.Image, {
|
|
11
|
+
const image = (0, utils_2.getMediaImage)(icon !== null && icon !== void 0 ? icon : {});
|
|
12
|
+
return react_1.default.createElement(components_1.Image, Object.assign({}, image, { alt: image.alt || title, className: b('icon') }));
|
|
13
13
|
}
|
|
14
14
|
const TutorialCard = (props) => {
|
|
15
15
|
const { url, title, text, border, icon } = props;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TutorialCard = void 0;
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
|
+
const schema_1 = require("../../components/Image/schema");
|
|
5
6
|
exports.TutorialCard = {
|
|
6
7
|
'tutorial-card': {
|
|
7
8
|
additionalProperties: false,
|
|
@@ -12,6 +13,6 @@ exports.TutorialCard = {
|
|
|
12
13
|
type: 'string',
|
|
13
14
|
}, text: {
|
|
14
15
|
type: 'string',
|
|
15
|
-
}, icon:
|
|
16
|
+
}, icon: schema_1.ImageProps }),
|
|
16
17
|
},
|
|
17
18
|
};
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
3
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
4
|
-
import { BREAKPOINTS } from '../../constants';
|
|
5
4
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
5
|
+
import { Image } from '../../components';
|
|
6
6
|
import './Companies.css';
|
|
7
7
|
const b = block('companies-block');
|
|
8
8
|
export const CompaniesBlock = ({ title, images, animated }) => {
|
|
9
9
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
10
10
|
const themedImages = getThemedValue(images, theme) || {};
|
|
11
|
-
const { desktop, mobile, tablet, alt } = themedImages;
|
|
12
11
|
return (React.createElement(AnimateBlock, { className: b(), offset: 150, animate: animated },
|
|
13
12
|
React.createElement("div", { className: b('content') },
|
|
14
13
|
React.createElement("h2", { className: b('title') }, title),
|
|
15
14
|
React.createElement("div", { className: b('images') },
|
|
16
|
-
React.createElement(
|
|
17
|
-
React.createElement("source", { srcSet: desktop, media: `(min-width: ${BREAKPOINTS.md}px)` }),
|
|
18
|
-
React.createElement("source", { srcSet: tablet, media: `(min-width: ${BREAKPOINTS.sm}px)` }),
|
|
19
|
-
React.createElement("img", { className: b('image'), srcSet: mobile, alt: alt }))))));
|
|
15
|
+
React.createElement(Image, Object.assign({}, themedImages, { className: b('image') }))))));
|
|
20
16
|
};
|
|
21
17
|
export default CompaniesBlock;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ContentBlock } from '../../sub-blocks/Content/schema';
|
|
2
2
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
|
-
import { contentSizes, contentTextWidth, contentThemes, FileLinkProps,
|
|
3
|
+
import { contentSizes, contentTextWidth, contentThemes, FileLinkProps, BlockBaseProps, } from '../../schema/validators/common';
|
|
4
|
+
import { ImageObjectProps } from '../../components/Image/schema';
|
|
4
5
|
export const ContentLayoutBlock = {
|
|
5
6
|
'content-layout-block': {
|
|
6
7
|
additionalProperties: false,
|
|
@@ -9,6 +9,7 @@ unpredictable css rules order in build */
|
|
|
9
9
|
margin: 16px 0;
|
|
10
10
|
}
|
|
11
11
|
.pc-header-block_full-width {
|
|
12
|
+
--pc-border-radius: 0;
|
|
12
13
|
padding: 16px 0;
|
|
13
14
|
margin: 0 0 16px;
|
|
14
15
|
}
|
|
@@ -124,6 +125,16 @@ unpredictable css rules order in build */
|
|
|
124
125
|
top: 16px;
|
|
125
126
|
z-index: 11;
|
|
126
127
|
}
|
|
128
|
+
.pc-header-block__background-media {
|
|
129
|
+
height: 100%;
|
|
130
|
+
}
|
|
131
|
+
.pc-header-block__background-media > div {
|
|
132
|
+
height: 100%;
|
|
133
|
+
width: 100%;
|
|
134
|
+
}
|
|
135
|
+
.pc-header-block__background-media > div:not(.pc-header-block__video) {
|
|
136
|
+
position: absolute;
|
|
137
|
+
}
|
|
127
138
|
.pc-header-block__background, .pc-header-block__background.pc-header-block__background_media {
|
|
128
139
|
position: absolute;
|
|
129
140
|
top: 0;
|
|
@@ -142,19 +153,12 @@ unpredictable css rules order in build */
|
|
|
142
153
|
.pc-header-block__background.pc-header-block__background_full-width-media > div, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media > div {
|
|
143
154
|
max-width: none;
|
|
144
155
|
}
|
|
145
|
-
.pc-header-block__background.pc-header-block__background_full-width-media .pc-header-block__background-media, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media .pc-header-block__background-media {
|
|
146
|
-
height: 100%;
|
|
147
|
-
}
|
|
148
156
|
.pc-header-block__background.pc-header-block__background_full-width-media video, .pc-header-block__background.pc-header-block__background_media.pc-header-block__background_full-width-media video {
|
|
149
157
|
height: 100%;
|
|
150
158
|
width: 100%;
|
|
151
159
|
object-fit: cover;
|
|
152
160
|
}
|
|
153
|
-
.pc-header-block__background_full-width-media {
|
|
154
|
-
--pc-border-radius: 0;
|
|
155
|
-
}
|
|
156
161
|
.pc-header-block__background_full-width {
|
|
157
|
-
--pc-border-radius: 0;
|
|
158
162
|
left: 0;
|
|
159
163
|
transform: none;
|
|
160
164
|
max-width: none;
|
|
@@ -190,9 +194,6 @@ unpredictable css rules order in build */
|
|
|
190
194
|
.pc-header-block_has-media .pc-header-block__content {
|
|
191
195
|
padding-top: 48px;
|
|
192
196
|
}
|
|
193
|
-
.pc-header-block_has-background .pc-header-block__background-img {
|
|
194
|
-
display: none;
|
|
195
|
-
}
|
|
196
197
|
.pc-header-block .pc-header-block__content_vertical-offset_s, .pc-header-block .pc-header-block__content_vertical-offset_m, .pc-header-block .pc-header-block__content_vertical-offset_l, .pc-header-block .pc-header-block__content_vertical-offset_xl {
|
|
197
198
|
padding: calc(96px - 16px) 0;
|
|
198
199
|
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
|
-
import {
|
|
4
|
-
import { Button, Media, BackgroundMedia, BackgroundImage, RouterLink, HTML } from '../../components';
|
|
3
|
+
import { Button, Media, RouterLink, HTML } from '../../components';
|
|
5
4
|
import { Grid, Row, Col } from '../../grid';
|
|
6
5
|
import { getImageSize, getTitleSizes, titleWithImageSizes } from './utils';
|
|
6
|
+
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import YFMWrapper from '../../components/YFMWrapper/YFMWrapper';
|
|
8
8
|
import HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';
|
|
9
9
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
10
|
+
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
10
11
|
import './Header.css';
|
|
11
12
|
const b = block('header-block');
|
|
12
|
-
const Background = ({ background }) => {
|
|
13
|
-
const { url,
|
|
14
|
-
|
|
13
|
+
const Background = ({ background, isMobile }) => {
|
|
14
|
+
const { url, image, fullWidthMedia, video, color } = background;
|
|
15
|
+
const imageObject = url ? getMediaImage(url) : image;
|
|
16
|
+
const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);
|
|
17
|
+
return (React.createElement("div", { className: b('background', { media: true, 'full-width-media': fullWidthMedia }), style: { backgroundColor: color } }, renderMedia && (React.createElement(Media, Object.assign({}, background, { className: b('background-media'), imageClassName: b('image'), videoClassName: b('video'), isBackground: true, parallax: false, video: isMobile ? undefined : video, image: imageObject })))));
|
|
15
18
|
};
|
|
16
19
|
const FullWidthBackground = ({ background }) => (React.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
|
|
17
20
|
export const HeaderBlock = (props) => {
|
|
18
21
|
const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, children, } = props;
|
|
22
|
+
const isMobile = useContext(MobileContext);
|
|
19
23
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
20
|
-
const
|
|
24
|
+
const hasRightSideImage = Boolean(image || video);
|
|
21
25
|
const curImageSize = imageSize || getImageSize(width);
|
|
22
|
-
const titleSizes =
|
|
26
|
+
const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);
|
|
23
27
|
let curVerticalOffset = verticalOffset;
|
|
24
|
-
if (
|
|
28
|
+
if (hasRightSideImage && !verticalOffset) {
|
|
25
29
|
curVerticalOffset = 'm';
|
|
26
30
|
}
|
|
27
31
|
const backgroundThemed = background && getThemedValue(background, theme);
|
|
28
32
|
const imageThemed = image && getThemedValue(image, theme);
|
|
29
33
|
const videoThemed = video && getThemedValue(video, theme);
|
|
30
|
-
const fullWidth =
|
|
31
|
-
return (React.createElement("header", { className: b({
|
|
32
|
-
['has-media']: hasMedia,
|
|
33
|
-
['has-background']: Boolean(background),
|
|
34
|
-
['full-width']: fullWidth,
|
|
35
|
-
}, className) },
|
|
34
|
+
const fullWidth = (backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.fullWidth) || (backgroundThemed === null || backgroundThemed === void 0 ? void 0 : backgroundThemed.fullWidthMedia);
|
|
35
|
+
return (React.createElement("header", { className: b({ ['has-media']: hasRightSideImage, ['full-width']: fullWidth }, className) },
|
|
36
36
|
backgroundThemed && fullWidth && React.createElement(FullWidthBackground, { background: backgroundThemed }),
|
|
37
|
-
backgroundThemed && React.createElement(Background, { background: backgroundThemed }),
|
|
37
|
+
backgroundThemed && React.createElement(Background, { background: backgroundThemed, isMobile: isMobile }),
|
|
38
38
|
React.createElement(Grid, { containerClass: b('container-fluid') },
|
|
39
39
|
breadcrumbs && (React.createElement(Row, { className: b('breadcrumbs') },
|
|
40
40
|
React.createElement(Col, null,
|
|
@@ -59,6 +59,6 @@ export const HeaderBlock = (props) => {
|
|
|
59
59
|
buttons.map((button, index) => (React.createElement(RouterLink, { href: button.url, key: index },
|
|
60
60
|
React.createElement(Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button))))))),
|
|
61
61
|
children))),
|
|
62
|
-
|
|
62
|
+
hasRightSideImage && (React.createElement(Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed })))))));
|
|
63
63
|
};
|
|
64
64
|
export default HeaderBlock;
|