@gravity-ui/page-constructor 1.15.0-alpha.3 → 1.15.0-alpha.4
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/Banner/Banner.js +3 -2
- package/build/cjs/blocks/Banner/schema.d.ts +9 -0
- package/build/cjs/blocks/Banner/schema.js +3 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/cjs/blocks/Header/Header.js +6 -5
- package/build/cjs/blocks/Header/schema.d.ts +3 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/cjs/blocks/Icons/schema.d.ts +6 -0
- package/build/cjs/blocks/Info/Info.js +4 -3
- package/build/cjs/blocks/Info/schema.d.ts +3 -0
- package/build/cjs/blocks/Info/schema.js +2 -0
- package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/Media.js +3 -2
- package/build/cjs/blocks/Media/MediaContent.js +3 -2
- package/build/cjs/blocks/Media/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/cjs/blocks/Preview/Preview.js +3 -2
- package/build/cjs/blocks/Preview/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/schema.js +3 -1
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/Questions.js +3 -2
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/Security.js +3 -2
- package/build/cjs/blocks/Security/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/schema.js +3 -1
- package/build/cjs/blocks/Share/Share.d.ts +1 -1
- package/build/cjs/blocks/Share/Share.js +10 -2
- package/build/cjs/blocks/Simple/schema.d.ts +3 -0
- package/build/cjs/blocks/Slider/schema.d.ts +3 -0
- package/build/cjs/blocks/Table/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +5 -4
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
- package/build/cjs/components/BackLink/BackLink.js +10 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +12 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +5 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +3 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +7 -2
- package/build/cjs/components/Link/Link.js +4 -3
- package/build/cjs/components/Media/Media.js +4 -2
- package/build/cjs/components/Media/Video/Video.js +4 -2
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +14 -7
- package/build/cjs/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/cjs/components/YandexForm/YandexForm.js +8 -2
- package/build/cjs/constructor-items.d.ts +5 -5
- package/build/cjs/models/constructor-items/blocks.d.ts +11 -0
- package/build/cjs/models/constructor-items/common.d.ts +4 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/cjs/schema/validators/common.d.ts +3 -0
- package/build/cjs/schema/validators/common.js +2 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/cjs/sub-blocks/Content/Content.js +4 -3
- package/build/cjs/sub-blocks/HubspotForm/index.js +8 -2
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +9 -2
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/schema.js +3 -1
- package/build/esm/blocks/Banner/Banner.js +3 -2
- package/build/esm/blocks/Banner/schema.d.ts +9 -0
- package/build/esm/blocks/Banner/schema.js +3 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
- package/build/esm/blocks/ContentLayout/ContentLayout.js +3 -2
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +3 -2
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/esm/blocks/Header/Header.js +6 -5
- package/build/esm/blocks/Header/schema.d.ts +3 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/esm/blocks/Icons/schema.d.ts +6 -0
- package/build/esm/blocks/Info/Info.js +4 -3
- package/build/esm/blocks/Info/schema.d.ts +3 -0
- package/build/esm/blocks/Info/schema.js +2 -0
- package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
- package/build/esm/blocks/Media/Media.js +3 -2
- package/build/esm/blocks/Media/MediaContent.js +3 -2
- package/build/esm/blocks/Media/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +3 -2
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +1 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +3 -2
- package/build/esm/blocks/Preview/Preview.js +3 -2
- package/build/esm/blocks/Preview/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/schema.js +3 -1
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +3 -2
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/Questions.js +3 -2
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- package/build/esm/blocks/Security/Security.js +3 -2
- package/build/esm/blocks/Security/schema.d.ts +3 -0
- package/build/esm/blocks/Security/schema.js +3 -1
- package/build/esm/blocks/Share/Share.d.ts +1 -1
- package/build/esm/blocks/Share/Share.js +11 -3
- package/build/esm/blocks/Simple/schema.d.ts +3 -0
- package/build/esm/blocks/Slider/schema.d.ts +3 -0
- package/build/esm/blocks/Table/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +5 -4
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/BackLink/BackLink.d.ts +1 -0
- package/build/esm/components/BackLink/BackLink.js +10 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +2 -1
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +12 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.js +5 -2
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +3 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +7 -2
- package/build/esm/components/Link/Link.js +4 -3
- package/build/esm/components/Media/Media.js +4 -2
- package/build/esm/components/Media/Video/Video.js +4 -2
- package/build/esm/components/ReactPlayer/ReactPlayer.js +14 -7
- package/build/esm/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/esm/components/YandexForm/YandexForm.js +8 -2
- package/build/esm/constructor-items.d.ts +5 -5
- package/build/esm/models/constructor-items/blocks.d.ts +11 -0
- package/build/esm/models/constructor-items/common.d.ts +4 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/esm/schema/validators/common.d.ts +3 -0
- package/build/esm/schema/validators/common.js +2 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -2
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +3 -2
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +3 -2
- package/build/esm/sub-blocks/Content/Content.js +4 -3
- package/build/esm/sub-blocks/HubspotForm/index.js +8 -2
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +3 -2
- package/build/esm/sub-blocks/Quote/Quote.js +11 -4
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/schema.js +3 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +11 -0
- package/server/models/constructor-items/common.d.ts +4 -0
- package/server/models/constructor-items/sub-blocks.d.ts +4 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
|
+
import { BlockType, } from '../../models';
|
|
3
4
|
import { Button, Media, RouterLink, HTML } from '../../components';
|
|
4
5
|
import { Grid, Row, Col } from '../../grid';
|
|
5
6
|
import { getImageSize, getTitleSizes, titleWithImageSizes } from './utils';
|
|
@@ -10,15 +11,15 @@ import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
|
10
11
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
11
12
|
import './Header.css';
|
|
12
13
|
const b = block('header-block');
|
|
13
|
-
const Background = ({ background, isMobile }) => {
|
|
14
|
+
const Background = ({ background, isMobile, blockName }) => {
|
|
14
15
|
const { url, image, fullWidthMedia, video, color } = background;
|
|
15
16
|
const imageObject = url ? getMediaImage(url) : image;
|
|
16
17
|
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 })))));
|
|
18
|
+
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, blockName: blockName })))));
|
|
18
19
|
};
|
|
19
20
|
const FullWidthBackground = ({ background }) => (React.createElement("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background === null || background === void 0 ? void 0 : background.color } }));
|
|
20
21
|
export const HeaderBlock = (props) => {
|
|
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 { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, children, blockName = BlockType.HeaderBlock, } = props;
|
|
22
23
|
const isMobile = useContext(MobileContext);
|
|
23
24
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
24
25
|
const hasRightSideImage = Boolean(image || video);
|
|
@@ -57,8 +58,8 @@ export const HeaderBlock = (props) => {
|
|
|
57
58
|
React.createElement(YFMWrapper, { content: description, modifiers: { constructor: true } }))),
|
|
58
59
|
buttons && (React.createElement("div", { className: b('buttons'), "data-qa": "header-buttons" }, buttons &&
|
|
59
60
|
buttons.map((button, index) => (React.createElement(RouterLink, { href: button.url, key: index },
|
|
60
|
-
React.createElement(Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button))))))),
|
|
61
|
+
React.createElement(Button, Object.assign({ key: index, className: b('button'), size: "xl" }, button, { blockName: BlockType.HeaderBlock }))))))),
|
|
61
62
|
children))),
|
|
62
|
-
hasRightSideImage && (React.createElement(Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed })))))));
|
|
63
|
+
hasRightSideImage && (React.createElement(Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), video: videoThemed, image: imageThemed, blockName: blockName })))))));
|
|
63
64
|
};
|
|
64
65
|
export default HeaderBlock;
|
|
@@ -54,6 +54,9 @@ export declare const IconsProps: {
|
|
|
54
54
|
resetPaddings: {
|
|
55
55
|
type: string;
|
|
56
56
|
};
|
|
57
|
+
blockName: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
57
60
|
type: {};
|
|
58
61
|
when: {};
|
|
59
62
|
};
|
|
@@ -115,6 +118,9 @@ export declare const IconsBlock: {
|
|
|
115
118
|
resetPaddings: {
|
|
116
119
|
type: string;
|
|
117
120
|
};
|
|
121
|
+
blockName: {
|
|
122
|
+
type: string;
|
|
123
|
+
};
|
|
118
124
|
type: {};
|
|
119
125
|
when: {};
|
|
120
126
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
|
+
import { BlockType } from '../../models';
|
|
3
4
|
import { Grid, Row, Col } from '../../grid';
|
|
4
5
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
5
6
|
import Content from '../../sub-blocks/Content/Content';
|
|
@@ -7,7 +8,7 @@ import './Info.css';
|
|
|
7
8
|
const b = block('info-block');
|
|
8
9
|
const sizes = { md: 6, all: 12 };
|
|
9
10
|
export const InfoBlock = (props) => {
|
|
10
|
-
const { backgroundColor, theme: blockTheme = 'dark', buttons = [], title, sectionsTitle, links = [], rightContent = {}, leftContent = {}, } = props;
|
|
11
|
+
const { backgroundColor, theme: blockTheme = 'dark', buttons = [], title, sectionsTitle, links = [], rightContent = {}, leftContent = {}, blockName = BlockType.InfoBlock, } = props;
|
|
11
12
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
12
13
|
const contentTheme = blockTheme === 'dark' ? 'dark' : 'default';
|
|
13
14
|
const rightLinks = [
|
|
@@ -25,8 +26,8 @@ export const InfoBlock = (props) => {
|
|
|
25
26
|
React.createElement(Grid, null,
|
|
26
27
|
React.createElement(Row, null,
|
|
27
28
|
React.createElement(Col, { sizes: sizes, className: b('left') },
|
|
28
|
-
React.createElement(Content, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
|
|
29
|
+
React.createElement(Content, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps, { blockName: blockName }))),
|
|
29
30
|
React.createElement(Col, { sizes: sizes, className: b('right') },
|
|
30
|
-
React.createElement(Content, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
|
|
31
|
+
React.createElement(Content, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps, { blockName: blockName }))))))));
|
|
31
32
|
};
|
|
32
33
|
export default InfoBlock;
|
|
@@ -18,6 +18,8 @@ export const InfoBlock = {
|
|
|
18
18
|
}), sectionsTitle: {
|
|
19
19
|
type: 'string',
|
|
20
20
|
contentType: 'text',
|
|
21
|
+
}, blockName: {
|
|
22
|
+
type: 'string',
|
|
21
23
|
}, buttons: filteredArray(ButtonBlock), theme: ThemeProps, links: filteredArray(LinkProps), leftContent: ContentProps, rightContent: ContentProps }),
|
|
22
24
|
},
|
|
23
25
|
};
|
|
@@ -2,6 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useContext, useMemo, useState } from 'react';
|
|
3
3
|
import { block, getThemedValue } from '../../utils';
|
|
4
4
|
import { Grid, Row, Col, GridColumnSize } from '../../grid';
|
|
5
|
+
import { BlockType } from '../../models';
|
|
5
6
|
import Media from '../../components/Media/Media';
|
|
6
7
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
7
8
|
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
@@ -10,7 +11,7 @@ import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
|
10
11
|
import './Media.css';
|
|
11
12
|
const b = block('media-block');
|
|
12
13
|
export const MediaBlock = (props) => {
|
|
13
|
-
const { media, largeMedia, direction = 'content-media', mobileDirection = 'content-media', animated, mediaOnly, disableShadow = false } = props, mediaContentProps = __rest(props, ["media", "largeMedia", "direction", "mobileDirection", "animated", "mediaOnly", "disableShadow"]);
|
|
14
|
+
const { media, largeMedia, direction = 'content-media', mobileDirection = 'content-media', animated, mediaOnly, disableShadow = false, blockName = BlockType.MediaBlock } = props, mediaContentProps = __rest(props, ["media", "largeMedia", "direction", "mobileDirection", "animated", "mediaOnly", "disableShadow", "blockName"]);
|
|
14
15
|
const { title, description } = mediaContentProps;
|
|
15
16
|
const [play, setPlay] = useState(false);
|
|
16
17
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
@@ -34,6 +35,6 @@ export const MediaBlock = (props) => {
|
|
|
34
35
|
React.createElement(Col, { className: b('content'), sizes: contentSizes }, mediaContent),
|
|
35
36
|
React.createElement(Col, { sizes: mediaSizes },
|
|
36
37
|
React.createElement("div", { className: b('card', { shadow: !disableShadow }) },
|
|
37
|
-
React.createElement(Media, Object.assign({}, mediaThemed, { playVideo: play }))))))));
|
|
38
|
+
React.createElement(Media, Object.assign({}, mediaThemed, { playVideo: play, blockName: blockName }))))))));
|
|
38
39
|
};
|
|
39
40
|
export default MediaBlock;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
|
+
import { BlockType } from '../../models';
|
|
3
4
|
import { Content } from '../../sub-blocks';
|
|
4
5
|
import './MediaContent.css';
|
|
5
6
|
const b = block('media-content');
|
|
6
7
|
const MediaContent = (props) => {
|
|
7
|
-
const { title, description, button, links, buttons = [], additionalInfo, size = 'l' } = props;
|
|
8
|
+
const { title, description, button, links, buttons = [], additionalInfo, size = 'l', blockName = BlockType.MediaBlock, } = props;
|
|
8
9
|
const allButtons = button ? [Object.assign(Object.assign({}, button), { size: 'xl' }), ...buttons] : buttons;
|
|
9
10
|
return (React.createElement("div", { className: b() },
|
|
10
|
-
React.createElement(Content, { title: title, text: description, links: links, theme: "default", buttons: allButtons, additionalInfo: additionalInfo, size: size, colSizes: { all: 12, md: 12 } })));
|
|
11
|
+
React.createElement(Content, { title: title, text: description, links: links, theme: "default", buttons: allButtons, additionalInfo: additionalInfo, size: size, colSizes: { all: 12, md: 12 }, blockName: blockName })));
|
|
11
12
|
};
|
|
12
13
|
export default MediaContent;
|
|
@@ -9,6 +9,7 @@ interface MediaContentProps extends Refable<HTMLDivElement> {
|
|
|
9
9
|
switching: boolean;
|
|
10
10
|
isActiveBlock: (id: number, isMediaBlock?: boolean) => boolean;
|
|
11
11
|
showMediaContent: (id: number) => void;
|
|
12
|
+
blockName?: string;
|
|
12
13
|
}
|
|
13
|
-
declare const MediaContent: React.ForwardRefExoticComponent<Pick<MediaContentProps, "title" | "items" | "description" | "ratioMediaContent" | "switching" | "isActiveBlock" | "showMediaContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const MediaContent: React.ForwardRefExoticComponent<Pick<MediaContentProps, "title" | "blockName" | "items" | "description" | "ratioMediaContent" | "switching" | "isActiveBlock" | "showMediaContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
export default MediaContent;
|
|
@@ -7,8 +7,9 @@ import PreviewMedia from './PreviewMedia';
|
|
|
7
7
|
import { ThemeValueContext } from '../../../context/theme/ThemeValueContext';
|
|
8
8
|
import './MediaContent.css';
|
|
9
9
|
const b = block('preview-media-content-block');
|
|
10
|
+
const COMPONENT_NAME = 'preview-media-content';
|
|
10
11
|
const MediaContent = forwardRef((props, ref) => {
|
|
11
|
-
const { items, title, description = '', switching, ratioMediaContent = '1-1', isActiveBlock, showMediaContent, } = props;
|
|
12
|
+
const { items, title, description = '', switching, ratioMediaContent = '1-1', isActiveBlock, showMediaContent, blockName = COMPONENT_NAME, } = props;
|
|
12
13
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
13
14
|
const [mediaSizes, setMediaSizes] = useState({ [GridColumnSize.All]: 12 });
|
|
14
15
|
const [contentSizes, setContentSizes] = useState({ [GridColumnSize.All]: 12 });
|
|
@@ -30,7 +31,7 @@ const MediaContent = forwardRef((props, ref) => {
|
|
|
30
31
|
const mediaMods = { active: isActiveBlock(id, true) };
|
|
31
32
|
const onClick = () => showMediaContent(id);
|
|
32
33
|
contentComponents.push(React.createElement(PreviewContent, Object.assign({ key: id, id: id }, content, { switching: switching, onClick: onClick, mods: contentMods })));
|
|
33
|
-
mediaComponents.push(React.createElement(PreviewMedia, { key: id, id: id, media: media && getThemedValue(media, theme), play: isActive, mods: mediaMods }));
|
|
34
|
+
mediaComponents.push(React.createElement(PreviewMedia, { key: id, id: id, media: media && getThemedValue(media, theme), play: isActive, mods: mediaMods, blockName: blockName }));
|
|
34
35
|
});
|
|
35
36
|
return (React.createElement(Fragment, null,
|
|
36
37
|
React.createElement(Col, { sizes: contentSizes, className: b('content') },
|
|
@@ -3,9 +3,10 @@ import { block } from '../../../utils';
|
|
|
3
3
|
import Media from '../../../components/Media/Media';
|
|
4
4
|
import './PreviewMedia.css';
|
|
5
5
|
const b = block('preview-media-block');
|
|
6
|
+
const COMPONENT_NAME = 'preview-media';
|
|
6
7
|
const PreviewMedia = (props) => {
|
|
7
|
-
const { id, media, play, mods } = props;
|
|
8
|
+
const { id, media, play, mods, blockName = COMPONENT_NAME } = props;
|
|
8
9
|
return (React.createElement("div", { key: id, className: b('media', mods) },
|
|
9
|
-
React.createElement(Media, Object.assign({}, media, { playVideo: play }))));
|
|
10
|
+
React.createElement(Media, Object.assign({}, media, { playVideo: play, blockName: blockName }))));
|
|
10
11
|
};
|
|
11
12
|
export default PreviewMedia;
|
|
@@ -4,6 +4,7 @@ import { BreakpointContext } from '../../context/breakpointContext';
|
|
|
4
4
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
5
5
|
import MediaContent from './MediaContent/MediaContent';
|
|
6
6
|
import { Row } from '../../grid';
|
|
7
|
+
import { BlockType } from '../../models';
|
|
7
8
|
import { BREAKPOINTS } from '../../constants';
|
|
8
9
|
import { useIntersection } from '../../hooks/useIntersection';
|
|
9
10
|
import './Preview.css';
|
|
@@ -19,7 +20,7 @@ const INDENT_BETWEEN_TITLE_DESCRIPTION = 16;
|
|
|
19
20
|
export const PreviewBlock = (props) => {
|
|
20
21
|
const { direction = 'content-media', animated, items, title, description, ratioMediaContent = '1-1', stopVideo = false,
|
|
21
22
|
// TODO YDB-server doesn't see previewRef.current and doesn't update the component CLOUDFRONT-9395
|
|
22
|
-
showImmediately = false, } = props;
|
|
23
|
+
showImmediately = false, blockName = BlockType.PreviewBlock, } = props;
|
|
23
24
|
const breakpoint = useContext(BreakpointContext);
|
|
24
25
|
const isDesktop = breakpoint >= BREAKPOINTS.md;
|
|
25
26
|
const menuRef = React.useRef(null);
|
|
@@ -82,7 +83,7 @@ export const PreviewBlock = (props) => {
|
|
|
82
83
|
}, [changeActiveSlide, activeSlide, autoSwitchTimerId]);
|
|
83
84
|
return (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
84
85
|
React.createElement(Row, { ref: previewRef, className: b('row', { reverse: direction === 'media-content' }) },
|
|
85
|
-
React.createElement(MediaContent, { ref: menuRef, items: items, title: title, description: description, ratioMediaContent: ratioMediaContent, switching: !stopSwitching, isActiveBlock: isActiveBlock, showMediaContent: showMediaContent }))));
|
|
86
|
+
React.createElement(MediaContent, { ref: menuRef, items: items, title: title, description: description, ratioMediaContent: ratioMediaContent, switching: !stopSwitching, isActiveBlock: isActiveBlock, showMediaContent: showMediaContent, blockName: blockName }))));
|
|
86
87
|
};
|
|
87
88
|
function changeMenuScroll(element, nextSlide, activeSlide) {
|
|
88
89
|
if (!element) {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import { BREAKPOINTS } from '../../constants';
|
|
4
4
|
import YFMWrapper from '../../components/YFMWrapper/YFMWrapper';
|
|
5
|
+
import { BlockType } from '../../models';
|
|
5
6
|
import Media from '../../components/Media/Media';
|
|
6
7
|
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
7
8
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
@@ -15,7 +16,7 @@ const breakpointColumns = {
|
|
|
15
16
|
[BREAKPOINTS.sm]: 1,
|
|
16
17
|
};
|
|
17
18
|
const PromoFeaturesBlock = (props) => {
|
|
18
|
-
const { items, title, description, theme, animated = true } = props;
|
|
19
|
+
const { items, title, description, theme, animated = true, blockName = BlockType.PromoFeaturesBlock, } = props;
|
|
19
20
|
const backgroundTheme = theme || 'default';
|
|
20
21
|
return (React.createElement(AnimateBlock, { className: b({ [backgroundTheme]: true }), animate: animated },
|
|
21
22
|
React.createElement(FullWidthBackground, { className: b('background', { [backgroundTheme]: true }) }),
|
|
@@ -31,7 +32,7 @@ const PromoFeaturesBlock = (props) => {
|
|
|
31
32
|
React.createElement("h4", { className: b('card-title') }, cardTitle),
|
|
32
33
|
React.createElement("div", { className: b('card-text') },
|
|
33
34
|
React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true } }))),
|
|
34
|
-
media && React.createElement(Media, Object.assign({ className: b('card-media') }, media))));
|
|
35
|
+
media && (React.createElement(Media, Object.assign({ className: b('card-media'), blockName: blockName }, media)))));
|
|
35
36
|
}))));
|
|
36
37
|
};
|
|
37
38
|
export default PromoFeaturesBlock;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
|
+
import { BlockType } from '../../models';
|
|
3
4
|
import Link from '../../components/Link/Link';
|
|
4
5
|
import { YFMWrapper, ToggleArrow, Foldable, HTML } from '../../components';
|
|
5
6
|
import { Row, Col } from '../../grid';
|
|
@@ -7,7 +8,7 @@ import { Content } from '../../sub-blocks';
|
|
|
7
8
|
import './Questions.css';
|
|
8
9
|
const b = block('QuestionsBlock');
|
|
9
10
|
const QuestionsBlock = (props) => {
|
|
10
|
-
const { title, text, additionalInfo, links, buttons, items } = props;
|
|
11
|
+
const { title, text, additionalInfo, links, buttons, items, blockName = BlockType.QuestionsBlock, } = props;
|
|
11
12
|
const [opened, setOpened] = useState([0]);
|
|
12
13
|
const toggleItem = (index) => {
|
|
13
14
|
let newState;
|
|
@@ -23,7 +24,7 @@ const QuestionsBlock = (props) => {
|
|
|
23
24
|
React.createElement(Row, null,
|
|
24
25
|
React.createElement(Col, { sizes: { all: 12, md: 4 } },
|
|
25
26
|
React.createElement("div", { className: b('title') },
|
|
26
|
-
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))),
|
|
27
|
+
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, blockName: blockName }))),
|
|
27
28
|
React.createElement(Col, { sizes: { all: 12, md: 8 } }, items.map(({ title: itemTitle, text: itemText, link, listStyle = 'dash' }, index) => {
|
|
28
29
|
const isOpened = opened.includes(index);
|
|
29
30
|
return (React.createElement("div", { key: itemTitle, className: b('item') },
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
|
+
import { BlockType } from '../../models';
|
|
3
4
|
import { FullWidthBackground, HTML, Media, Link, AnimateBlock } from '../../components';
|
|
4
5
|
import { Grid, Row, Col } from '../../grid';
|
|
5
6
|
import './Security.css';
|
|
6
7
|
const b = block('SecurityBlock');
|
|
7
8
|
export const SecurityBlock = (props) => {
|
|
8
|
-
const { backgroundColor, theme = 'dark', title, points, media, animated } = props;
|
|
9
|
+
const { backgroundColor, theme = 'dark', title, points, media, animated, blockName = BlockType.SecurityBlock, } = props;
|
|
9
10
|
return (React.createElement(AnimateBlock, { className: b({ theme }), offset: 200, animate: animated },
|
|
10
11
|
React.createElement("div", { className: b('content') },
|
|
11
12
|
React.createElement(FullWidthBackground, { className: b('background'), style: { backgroundColor } }),
|
|
@@ -19,6 +20,6 @@ export const SecurityBlock = (props) => {
|
|
|
19
20
|
link && (React.createElement(Link, { className: b('point-link'), text: link.text, url: link.url, theme: 'normal', arrow: true }))))))),
|
|
20
21
|
media && (React.createElement(Row, { className: b('media') },
|
|
21
22
|
React.createElement(Col, null,
|
|
22
|
-
React.createElement(Media, Object.assign({ className: b('media') }, media)))))))));
|
|
23
|
+
React.createElement(Media, Object.assign({ className: b('media') }, media, { blockName: blockName })))))))));
|
|
23
24
|
};
|
|
24
25
|
export default SecurityBlock;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, useCallback } from 'react';
|
|
2
2
|
import { Icon, Button } from '@gravity-ui/uikit';
|
|
3
3
|
import { block, getAbsolutePath, getShareLink } from '../../utils';
|
|
4
|
+
import { BlockType } from '../../models';
|
|
4
5
|
import { LocationContext } from '../../context/locationContext';
|
|
5
6
|
import i18n from './i18n';
|
|
7
|
+
import { useAnalytics } from 'src/hooks';
|
|
6
8
|
import { Facebook } from '../../icons/Facebook';
|
|
7
9
|
import { Twitter } from '../../icons/Twitter';
|
|
8
10
|
import { Linkedin } from '../../icons/Linkedin';
|
|
@@ -17,15 +19,21 @@ const icons = {
|
|
|
17
19
|
telegram: Telegram,
|
|
18
20
|
};
|
|
19
21
|
const b = block('share-block');
|
|
20
|
-
const Share = ({ items, title }) => {
|
|
22
|
+
const Share = ({ items, title, blockName = BlockType.ShareBlock }) => {
|
|
21
23
|
const { pathname, hostname } = useContext(LocationContext);
|
|
24
|
+
const handleAnalytics = useAnalytics();
|
|
25
|
+
const handleButtonClick = useCallback(() => handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics([], {
|
|
26
|
+
name: 'default',
|
|
27
|
+
type: 'button',
|
|
28
|
+
block: blockName,
|
|
29
|
+
}), [handleAnalytics, blockName]);
|
|
22
30
|
return (React.createElement("div", { className: b() },
|
|
23
31
|
React.createElement("h5", { className: b('title') }, title || i18n('constructor-share')),
|
|
24
32
|
React.createElement("div", { className: b('items') }, items.map((type) => {
|
|
25
33
|
const url = getAbsolutePath(hostname, pathname);
|
|
26
34
|
const socialUrl = getShareLink(url, type);
|
|
27
35
|
const icon = icons[type];
|
|
28
|
-
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }) }, icon && React.createElement(Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
36
|
+
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }), onClick: handleButtonClick }, icon && React.createElement(Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
29
37
|
}))));
|
|
30
38
|
};
|
|
31
39
|
export default Share;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TabsBlockProps } from '../../models';
|
|
2
2
|
import './Tabs.css';
|
|
3
|
-
export declare const TabsBlock: ({ items, title, description, animated, tabsColSizes, centered, direction, }: TabsBlockProps) => JSX.Element;
|
|
3
|
+
export declare const TabsBlock: ({ items, title, description, animated, tabsColSizes, centered, direction, blockName, }: TabsBlockProps) => JSX.Element;
|
|
4
4
|
export default TabsBlock;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useRef, useState } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
3
|
import { Row, Col, GridColumnOrderClasses } from '../../grid';
|
|
4
|
+
import { BlockType } from '../../models';
|
|
4
5
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
5
6
|
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
6
7
|
import FullScreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
@@ -12,7 +13,7 @@ import { Content } from '../../sub-blocks';
|
|
|
12
13
|
import { getHeight } from '../../components/VideoBlock/VideoBlock';
|
|
13
14
|
import './Tabs.css';
|
|
14
15
|
const b = block('tabs-block');
|
|
15
|
-
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', }) => {
|
|
16
|
+
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', blockName = BlockType.TabsBlock, }) => {
|
|
16
17
|
var _a;
|
|
17
18
|
const [activeTab, setActiveTab] = useState(items[0].tabName);
|
|
18
19
|
const [play, setPlay] = useState(false);
|
|
@@ -37,12 +38,12 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
37
38
|
React.createElement(Content, { title: activeTabData.title, text: activeTabData.text, additionalInfo: activeTabData.additionalInfo, size: "s", links: [
|
|
38
39
|
...(activeTabData.link ? [activeTabData.link] : []),
|
|
39
40
|
...(activeTabData.links || []),
|
|
40
|
-
], buttons: activeTabData.buttons, colSizes: { all: 12 } }))));
|
|
41
|
+
], buttons: activeTabData.buttons, colSizes: { all: 12 }, blockName: blockName }))));
|
|
41
42
|
const mediaContent = showMedia && (React.createElement(Col, { sizes: { all: 12, md: 8 }, orders: {
|
|
42
43
|
all: GridColumnOrderClasses.Last,
|
|
43
44
|
md: GridColumnOrderClasses.First,
|
|
44
45
|
}, className: b('col', { centered: centered }) },
|
|
45
|
-
React.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight })))),
|
|
46
|
+
React.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight, blockName: blockName })))),
|
|
46
47
|
imageProps && (React.createElement(Fragment, null,
|
|
47
48
|
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
|
|
48
49
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && React.createElement("p", { className: b('caption') }, activeTabData.caption)));
|
|
@@ -50,7 +51,7 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
50
51
|
React.createElement(BlockHeader, { title: title, description: description, className: b('block-title', { centered: centered }) }),
|
|
51
52
|
React.createElement(Row, null,
|
|
52
53
|
React.createElement(Col, { sizes: tabsColSizes },
|
|
53
|
-
React.createElement(ButtonTabs, { items: tabs, onSelectTab: setActiveTab, activeTab: activeTab, className: b('tabs', { centered: centered }) }))),
|
|
54
|
+
React.createElement(ButtonTabs, { items: tabs, onSelectTab: setActiveTab, activeTab: activeTab, className: b('tabs', { centered: centered }), blockName: BlockType.TabsBlock }))),
|
|
54
55
|
activeTabData && (React.createElement(Row, { className: b('row', { reverse: isReverse }) },
|
|
55
56
|
mediaContent,
|
|
56
57
|
textContent))));
|
|
@@ -2,10 +2,18 @@ import React, { useCallback, useContext } from 'react';
|
|
|
2
2
|
import { Button, Icon } from '@gravity-ui/uikit';
|
|
3
3
|
import { ArrowSidebar } from '../../icons';
|
|
4
4
|
import { LocationContext } from '../../context/locationContext';
|
|
5
|
+
import { useAnalytics } from 'src/hooks';
|
|
6
|
+
const COMPONENT_NAME = 'backlink';
|
|
5
7
|
export default function BackLink(props) {
|
|
6
8
|
const { history } = useContext(LocationContext);
|
|
7
|
-
const
|
|
9
|
+
const handleAnalytics = useAnalytics();
|
|
10
|
+
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, blockName = COMPONENT_NAME, } = props;
|
|
8
11
|
const backActionHandler = useCallback(async () => {
|
|
12
|
+
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics([], {
|
|
13
|
+
name: 'default',
|
|
14
|
+
type: 'button',
|
|
15
|
+
block: blockName,
|
|
16
|
+
});
|
|
9
17
|
if (!history) {
|
|
10
18
|
return;
|
|
11
19
|
}
|
|
@@ -18,7 +26,7 @@ export default function BackLink(props) {
|
|
|
18
26
|
else {
|
|
19
27
|
history.push({ pathname: url });
|
|
20
28
|
}
|
|
21
|
-
}, [history, onClick, url]);
|
|
29
|
+
}, [blockName, handleAnalytics, history, onClick, url]);
|
|
22
30
|
return (React.createElement(Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
|
|
23
31
|
React.createElement(Icon, { data: ArrowSidebar, size: 24 }),
|
|
24
32
|
React.createElement("span", null, title)));
|
|
@@ -6,11 +6,12 @@ import AnimateBlock from '../AnimateBlock/AnimateBlock';
|
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import './BackgroundMedia.css';
|
|
8
8
|
const b = block('BackgroundMedia');
|
|
9
|
+
const COMPONENT_NAME = 'backgound-media-component';
|
|
9
10
|
const BackgroundMedia = (_a) => {
|
|
10
11
|
var { className, color, animated, parallax = true, video, mediaClassName } = _a, props = __rest(_a, ["className", "color", "animated", "parallax", "video", "mediaClassName"]);
|
|
11
12
|
const isMobile = useContext(MobileContext);
|
|
12
13
|
return (React.createElement(AnimateBlock, { className: b(null, className), style: { backgroundColor: color }, animate: animated },
|
|
13
14
|
React.createElement(Media, Object.assign({ className: b('media', mediaClassName), imageClassName: b('image'), videoClassName: b('video'), isBackground: true }, Object.assign({ height: 720, color,
|
|
14
|
-
parallax, video: isMobile ? undefined : video }, props)))));
|
|
15
|
+
parallax, video: isMobile ? undefined : video }, props), { blockName: COMPONENT_NAME }))));
|
|
15
16
|
};
|
|
16
17
|
export default BackgroundMedia;
|