@gravity-ui/page-constructor 1.15.0-alpha.9 → 1.15.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 +39 -0
- package/README.md +5 -75
- package/build/cjs/blocks/Banner/Banner.js +2 -3
- package/build/cjs/blocks/Banner/schema.d.ts +0 -243
- package/build/cjs/blocks/Banner/schema.js +1 -3
- package/build/cjs/blocks/CardLayout/schema.d.ts +0 -6
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +2 -3
- package/build/cjs/blocks/ContentLayout/schema.d.ts +0 -3
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -3
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +0 -3
- package/build/cjs/blocks/Header/Header.js +5 -6
- package/build/cjs/blocks/Header/schema.d.ts +0 -3
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +0 -3
- package/build/cjs/blocks/Icons/schema.d.ts +0 -6
- package/build/cjs/blocks/Info/Info.js +3 -4
- package/build/cjs/blocks/Info/schema.d.ts +0 -3
- package/build/cjs/blocks/Info/schema.js +0 -2
- package/build/cjs/blocks/LinkTable/schema.d.ts +0 -3
- package/build/cjs/blocks/Media/Media.js +2 -3
- package/build/cjs/blocks/Media/MediaContent.js +2 -3
- package/build/cjs/blocks/Media/schema.d.ts +0 -81
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +1 -2
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +2 -3
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -1
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +2 -3
- package/build/cjs/blocks/Preview/Preview.js +2 -3
- package/build/cjs/blocks/Preview/schema.d.ts +0 -3
- package/build/cjs/blocks/Preview/schema.js +1 -3
- package/build/cjs/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +2 -3
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +0 -3
- package/build/cjs/blocks/Questions/Questions.js +2 -3
- package/build/cjs/blocks/Questions/schema.d.ts +0 -3
- package/build/cjs/blocks/Security/Security.js +2 -3
- package/build/cjs/blocks/Security/schema.d.ts +0 -3
- package/build/cjs/blocks/Security/schema.js +1 -3
- package/build/cjs/blocks/Share/Share.d.ts +1 -1
- package/build/cjs/blocks/Share/Share.js +2 -10
- package/build/cjs/blocks/Simple/schema.d.ts +0 -3
- package/build/cjs/blocks/Slider/schema.d.ts +0 -3
- package/build/cjs/blocks/Table/schema.d.ts +0 -3
- package/build/cjs/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +4 -5
- package/build/cjs/blocks/Tabs/schema.d.ts +0 -3
- package/build/cjs/components/BackLink/BackLink.d.ts +0 -1
- package/build/cjs/components/BackLink/BackLink.js +2 -11
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.js +1 -2
- package/build/cjs/components/Button/Button.d.ts +0 -1
- package/build/cjs/components/Button/Button.js +2 -11
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +0 -1
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +2 -11
- package/build/cjs/components/CardBase/CardBase.d.ts +0 -3
- package/build/cjs/components/CardBase/CardBase.js +1 -10
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -10
- package/build/cjs/components/Link/Link.js +2 -11
- package/build/cjs/components/Media/Media.js +5 -7
- package/build/cjs/components/Media/Video/Video.js +3 -6
- package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
- package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
- package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
- package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
- package/build/cjs/components/MetaInfo/schema.js +10 -0
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +3 -15
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
- package/build/cjs/components/YandexForm/YandexForm.d.ts +0 -3
- package/build/cjs/components/YandexForm/YandexForm.js +2 -19
- package/build/cjs/components/index.d.ts +2 -0
- package/build/cjs/components/index.js +5 -1
- package/build/cjs/constructor-items.d.ts +9 -5
- package/build/cjs/constructor-items.js +4 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/cjs/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/cjs/containers/PageConstructor/Provider.js +1 -3
- package/build/cjs/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/cjs/hooks/index.d.ts +0 -1
- package/build/cjs/hooks/index.js +0 -1
- package/build/cjs/hooks/useMetrika.d.ts +0 -6
- package/build/cjs/hooks/useMetrika.js +0 -8
- package/build/cjs/models/common.d.ts +0 -34
- package/build/cjs/models/common.js +1 -10
- package/build/cjs/models/constructor-items/blocks.d.ts +0 -11
- package/build/cjs/models/constructor-items/common.d.ts +2 -27
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +16 -6
- package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +2 -3
- package/build/cjs/schema/index.js +1 -0
- package/build/cjs/schema/validators/common.d.ts +0 -171
- package/build/cjs/schema/validators/common.js +0 -12
- package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
- package/build/cjs/schema/validators/sub-blocks.js +1 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +0 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +0 -2
- package/build/cjs/sub-blocks/BannerCard/BannerCard.js +2 -3
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +2 -3
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +2 -3
- package/build/cjs/sub-blocks/Content/Content.js +3 -4
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/cjs/sub-blocks/HubspotForm/index.js +3 -18
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -0
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -3
- package/build/cjs/sub-blocks/Quote/Quote.js +2 -9
- package/build/cjs/sub-blocks/Quote/schema.d.ts +0 -3
- package/build/cjs/sub-blocks/Quote/schema.js +1 -3
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/cjs/text-transform/blocks.js +17 -0
- package/build/cjs/utils/hubspot.d.ts +2 -1
- package/build/cjs/utils/hubspot.js +5 -1
- package/build/esm/blocks/Banner/Banner.js +2 -3
- package/build/esm/blocks/Banner/schema.d.ts +0 -243
- package/build/esm/blocks/Banner/schema.js +1 -3
- package/build/esm/blocks/CardLayout/schema.d.ts +0 -6
- package/build/esm/blocks/ContentLayout/ContentLayout.js +2 -3
- package/build/esm/blocks/ContentLayout/schema.d.ts +0 -3
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +2 -3
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +0 -3
- package/build/esm/blocks/Header/Header.js +5 -6
- package/build/esm/blocks/Header/schema.d.ts +0 -3
- package/build/esm/blocks/HeaderSlider/schema.d.ts +0 -3
- package/build/esm/blocks/Icons/schema.d.ts +0 -6
- package/build/esm/blocks/Info/Info.js +3 -4
- package/build/esm/blocks/Info/schema.d.ts +0 -3
- package/build/esm/blocks/Info/schema.js +0 -2
- package/build/esm/blocks/LinkTable/schema.d.ts +0 -3
- package/build/esm/blocks/Media/Media.js +2 -3
- package/build/esm/blocks/Media/MediaContent.js +2 -3
- package/build/esm/blocks/Media/schema.d.ts +0 -81
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +1 -2
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +2 -3
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -1
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +2 -3
- package/build/esm/blocks/Preview/Preview.js +2 -3
- package/build/esm/blocks/Preview/schema.d.ts +0 -3
- package/build/esm/blocks/Preview/schema.js +1 -3
- package/build/esm/blocks/PromoFeaturesBlock/PromoFeaturesBlock.js +2 -3
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +0 -3
- package/build/esm/blocks/Questions/Questions.js +2 -3
- package/build/esm/blocks/Questions/schema.d.ts +0 -3
- package/build/esm/blocks/Security/Security.js +2 -3
- package/build/esm/blocks/Security/schema.d.ts +0 -3
- package/build/esm/blocks/Security/schema.js +1 -3
- package/build/esm/blocks/Share/Share.d.ts +1 -1
- package/build/esm/blocks/Share/Share.js +3 -11
- package/build/esm/blocks/Simple/schema.d.ts +0 -3
- package/build/esm/blocks/Slider/schema.d.ts +0 -3
- package/build/esm/blocks/Table/schema.d.ts +0 -3
- package/build/esm/blocks/Tabs/Tabs.d.ts +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +4 -5
- package/build/esm/blocks/Tabs/schema.d.ts +0 -3
- package/build/esm/components/BackLink/BackLink.d.ts +0 -1
- package/build/esm/components/BackLink/BackLink.js +2 -11
- package/build/esm/components/BackgroundMedia/BackgroundMedia.js +1 -2
- package/build/esm/components/Button/Button.d.ts +0 -1
- package/build/esm/components/Button/Button.js +2 -11
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +0 -1
- package/build/esm/components/ButtonTabs/ButtonTabs.js +2 -11
- package/build/esm/components/CardBase/CardBase.d.ts +0 -3
- package/build/esm/components/CardBase/CardBase.js +1 -10
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
- package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -10
- package/build/esm/components/Link/Link.js +2 -11
- package/build/esm/components/Media/Media.js +5 -7
- package/build/esm/components/Media/Video/Video.js +3 -6
- package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
- package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
- package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
- package/build/esm/components/MetaInfo/schema.d.ts +8 -0
- package/build/esm/components/MetaInfo/schema.js +8 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.js +4 -16
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
- package/build/esm/components/YandexForm/YandexForm.d.ts +0 -3
- package/build/esm/components/YandexForm/YandexForm.js +2 -19
- package/build/esm/components/index.d.ts +2 -0
- package/build/esm/components/index.js +2 -0
- package/build/esm/constructor-items.d.ts +9 -5
- package/build/esm/constructor-items.js +5 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
- package/build/esm/containers/PageConstructor/Provider.d.ts +0 -2
- package/build/esm/containers/PageConstructor/Provider.js +1 -3
- package/build/esm/context/metrikaContext/metrikaContext.d.ts +0 -6
- package/build/esm/hooks/index.d.ts +0 -1
- package/build/esm/hooks/index.js +0 -1
- package/build/esm/hooks/useMetrika.d.ts +0 -6
- package/build/esm/hooks/useMetrika.js +0 -8
- package/build/esm/models/common.d.ts +0 -34
- package/build/esm/models/common.js +0 -9
- package/build/esm/models/constructor-items/blocks.d.ts +0 -11
- package/build/esm/models/constructor-items/common.d.ts +2 -27
- package/build/esm/models/constructor-items/sub-blocks.d.ts +16 -6
- package/build/esm/models/constructor-items/sub-blocks.js +4 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +2 -3
- package/build/esm/schema/index.js +1 -0
- package/build/esm/schema/validators/common.d.ts +0 -171
- package/build/esm/schema/validators/common.js +0 -12
- package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
- package/build/esm/schema/validators/sub-blocks.js +1 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +0 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.js +0 -2
- package/build/esm/sub-blocks/BannerCard/BannerCard.js +2 -3
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +2 -3
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +1 -1
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +2 -3
- package/build/esm/sub-blocks/Content/Content.js +3 -4
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +2 -2
- package/build/esm/sub-blocks/HubspotForm/index.js +4 -19
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +15 -0
- package/build/esm/sub-blocks/LayoutItem/utils.js +6 -0
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -3
- package/build/esm/sub-blocks/Quote/Quote.js +4 -11
- package/build/esm/sub-blocks/Quote/schema.d.ts +0 -3
- package/build/esm/sub-blocks/Quote/schema.js +1 -3
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/build/esm/text-transform/blocks.js +17 -0
- package/build/esm/utils/hubspot.d.ts +2 -1
- package/build/esm/utils/hubspot.js +5 -1
- package/package.json +4 -5
- package/server/models/common.d.ts +0 -34
- package/server/models/common.js +1 -10
- package/server/models/constructor-items/blocks.d.ts +0 -11
- package/server/models/constructor-items/common.d.ts +2 -27
- package/server/models/constructor-items/sub-blocks.d.ts +16 -6
- package/server/models/constructor-items/sub-blocks.js +4 -0
- package/server/text-transform/blocks.js +17 -0
- package/server/utils/hubspot.d.ts +2 -1
- package/server/utils/hubspot.js +5 -1
- package/styles/root.scss +1 -0
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/cjs/context/analyticsContext/analyticsContext.js +0 -6
- package/build/cjs/context/analyticsContext/index.d.ts +0 -1
- package/build/cjs/context/analyticsContext/index.js +0 -4
- package/build/cjs/hooks/useAnalytics.d.ts +0 -2
- package/build/cjs/hooks/useAnalytics.js +0 -23
- package/build/cjs/schema/validators/event.d.ts +0 -37
- package/build/cjs/schema/validators/event.js +0 -38
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +0 -6
- package/build/esm/context/analyticsContext/analyticsContext.js +0 -2
- package/build/esm/context/analyticsContext/index.d.ts +0 -1
- package/build/esm/context/analyticsContext/index.js +0 -1
- package/build/esm/hooks/useAnalytics.d.ts +0 -2
- package/build/esm/hooks/useAnalytics.js +0 -19
- package/build/esm/schema/validators/event.d.ts +0 -37
- package/build/esm/schema/validators/event.js +0 -35
|
@@ -3,22 +3,14 @@ import { block } from '../../utils';
|
|
|
3
3
|
import BackgroundImage from '../BackgroundImage/BackgroundImage';
|
|
4
4
|
import RouterLink from '../RouterLink/RouterLink';
|
|
5
5
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
6
|
-
import { PredefinedEventTypes } from '../../models/common';
|
|
7
|
-
import { useAnalytics } from '../../hooks';
|
|
8
6
|
import './CardBase.css';
|
|
9
|
-
const COMPONENT_NAME = 'card-base';
|
|
10
7
|
const b = block('card-base-block');
|
|
11
8
|
const Header = () => null;
|
|
12
9
|
const Content = () => null;
|
|
13
10
|
const Footer = () => null;
|
|
14
11
|
export const Layout = (props) => {
|
|
15
|
-
const { className, bodyClassName, metrikaGoals, pixelEvents,
|
|
12
|
+
const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
|
|
16
13
|
const handleMetrika = useMetrika();
|
|
17
|
-
const handleAnalytics = useAnalytics({
|
|
18
|
-
name: 'card-base-click',
|
|
19
|
-
type: PredefinedEventTypes.Default,
|
|
20
|
-
blockName: blockName,
|
|
21
|
-
});
|
|
22
14
|
let header, content, footer, image, headerClass, footerClass;
|
|
23
15
|
function handleChild(child) {
|
|
24
16
|
switch (child.type) {
|
|
@@ -51,7 +43,6 @@ export const Layout = (props) => {
|
|
|
51
43
|
const fullClassName = b({ border }, className);
|
|
52
44
|
const onClick = () => {
|
|
53
45
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
54
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
55
46
|
};
|
|
56
47
|
return url ? (React.createElement(RouterLink, { href: url },
|
|
57
48
|
React.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (React.createElement("div", { className: fullClassName }, cardContent));
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Icon, Modal } from '@gravity-ui/uikit';
|
|
3
3
|
import { block } from '../../utils';
|
|
4
4
|
import Image from '../Image/Image';
|
|
5
5
|
import { PreviewClose, FullScreen } from '../../icons';
|
|
6
6
|
import './FullScreenImage.css';
|
|
7
7
|
const b = block('FullScreenImage');
|
|
8
|
+
const FULL_SCREEN_ICON_SIZE = 18;
|
|
9
|
+
const CLOSE_ICON_SIZE = 30;
|
|
8
10
|
const FullScreenImage = (props) => {
|
|
9
11
|
const { imageClassName, modalImageClass, imageStyle } = props;
|
|
10
12
|
const [isOpened, setIsOpened] = useState(false);
|
|
11
13
|
const [isMouseEnter, setIsMouseEnter] = useState(false);
|
|
12
|
-
const openModal =
|
|
13
|
-
const closeModal =
|
|
14
|
-
const showFullScreenIcon =
|
|
15
|
-
const hideFullScreenIcon =
|
|
14
|
+
const openModal = () => setIsOpened(true);
|
|
15
|
+
const closeModal = () => setIsOpened(false);
|
|
16
|
+
const showFullScreenIcon = () => setIsMouseEnter(true);
|
|
17
|
+
const hideFullScreenIcon = () => setIsMouseEnter(false);
|
|
16
18
|
return (React.createElement("div", { className: b() },
|
|
17
19
|
React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
|
|
18
20
|
React.createElement(Image, Object.assign({}, props, { className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
|
|
19
21
|
React.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
|
|
20
|
-
React.createElement(Icon, { data: FullScreen, width:
|
|
22
|
+
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
|
|
21
23
|
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
22
24
|
React.createElement("div", { className: b('modal-content') },
|
|
23
25
|
React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
24
|
-
React.createElement(Icon, { data: PreviewClose, width:
|
|
26
|
+
React.createElement(Icon, { data: PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
25
27
|
React.createElement(Image, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
|
|
26
28
|
};
|
|
27
29
|
export default FullScreenImage;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-full-screen-media__modal-media_type_youtube, .pc-full-screen-media__modal-media_type_video video, .pc-full-screen-media__modal-media_type_image {
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
max-width: 1232px;
|
|
8
|
+
max-height: 70vh;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.pc-full-screen-media__media {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
.pc-full-screen-media__media-wrapper {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
.pc-full-screen-media__modal-content {
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
.pc-full-screen-media__inline-media {
|
|
22
|
+
transform: translateZ(0);
|
|
23
|
+
}
|
|
24
|
+
.pc-full-screen-media__modal-media {
|
|
25
|
+
border-radius: var(--pc-border-radius);
|
|
26
|
+
}
|
|
27
|
+
.pc-full-screen-media__modal-media_type_youtube {
|
|
28
|
+
width: 70vw;
|
|
29
|
+
height: calc(70vw * 9 / 16);
|
|
30
|
+
}
|
|
31
|
+
.pc-full-screen-media__modal .yc-modal__content, .pc-full-screen-media__modal-image {
|
|
32
|
+
border-radius: var(--pc-border-radius);
|
|
33
|
+
}
|
|
34
|
+
.pc-full-screen-media__icon-wrapper {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
position: absolute;
|
|
39
|
+
right: 16px;
|
|
40
|
+
top: 16px;
|
|
41
|
+
width: 36px;
|
|
42
|
+
height: 36px;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
background-color: var(--yc-color-base-simple-hover-solid);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
z-index: 10;
|
|
47
|
+
}
|
|
48
|
+
.pc-full-screen-media__modal-content .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper .pc-full-screen-media__icon-wrapper {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transition: opacity 0.3s;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
}
|
|
53
|
+
.pc-full-screen-media__modal-content:hover .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper:hover .pc-full-screen-media__icon-wrapper {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
pointer-events: inherit;
|
|
56
|
+
}
|
|
57
|
+
.pc-full-screen-media__icon {
|
|
58
|
+
color: var(--yc-color-text-hint);
|
|
59
|
+
}
|
|
60
|
+
.pc-full-screen-media__icon_hover:hover {
|
|
61
|
+
color: var(--yc-color-text-secondary);
|
|
62
|
+
}
|
|
63
|
+
@media (max-width: 577px) {
|
|
64
|
+
.pc-full-screen-media__icon-wrapper {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
.pc-full-screen-media__modal {
|
|
68
|
+
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MediaAllProps } from '../Media/Media';
|
|
3
|
+
import './FullScreenMedia.css';
|
|
4
|
+
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
5
|
+
export interface FullScreenMediaProps {
|
|
6
|
+
showFullScreenIcon?: boolean;
|
|
7
|
+
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
10
|
+
export default FullScreenMedia;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useContext, useState } from 'react';
|
|
2
|
+
import { Icon, Modal } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import { PreviewClose, FullScreen } from '../../icons';
|
|
5
|
+
import { MobileContext } from '../../context/mobileContext';
|
|
6
|
+
import './FullScreenMedia.css';
|
|
7
|
+
const b = block('full-screen-media');
|
|
8
|
+
const FULL_SCREEN_ICON_SIZE = 18;
|
|
9
|
+
const CLOSE_ICON_SIZE = 30;
|
|
10
|
+
const getMediaClass = (type) => b('modal-media', { type });
|
|
11
|
+
const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
12
|
+
const [isOpened, setIsOpened] = useState(false);
|
|
13
|
+
const isMobile = useContext(MobileContext);
|
|
14
|
+
const openModal = (e) => {
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
setIsOpened(true);
|
|
17
|
+
};
|
|
18
|
+
const closeModal = () => setIsOpened(false);
|
|
19
|
+
if (isMobile) {
|
|
20
|
+
return children();
|
|
21
|
+
}
|
|
22
|
+
return (React.createElement("div", { className: b() },
|
|
23
|
+
React.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
24
|
+
children({ className: b('inline-media') }),
|
|
25
|
+
showFullScreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
26
|
+
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
|
|
27
|
+
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
28
|
+
React.createElement("div", { className: b('modal-content') },
|
|
29
|
+
React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
30
|
+
React.createElement(Icon, { data: PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
31
|
+
children({
|
|
32
|
+
imageClassName: getMediaClass('image'),
|
|
33
|
+
videoClassName: getMediaClass('video'),
|
|
34
|
+
youtubeClassName: getMediaClass('youtube'),
|
|
35
|
+
fullScreen: true,
|
|
36
|
+
}))))));
|
|
37
|
+
};
|
|
38
|
+
export default FullScreenMedia;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
|
-
import { PredefinedEventTypes } from '../../models';
|
|
4
3
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
5
|
-
import { useAnalytics } from '../../hooks';
|
|
6
4
|
import './HeaderBreadcrumbs.css';
|
|
7
5
|
const b = block('header-breadcrumbs');
|
|
8
|
-
const COMPONENT_NAME = 'header-breadcrumbs';
|
|
9
6
|
export default function HeaderBreadcrumbs(props) {
|
|
10
|
-
const { items, metrikaGoals, pixelEvents,
|
|
7
|
+
const { items, metrikaGoals, pixelEvents, theme = 'light', className } = props;
|
|
11
8
|
const handleMetrika = useMetrika();
|
|
12
|
-
const handleAnalytics = useAnalytics({
|
|
13
|
-
name: 'header-breadcrumbs-click',
|
|
14
|
-
type: PredefinedEventTypes.Default,
|
|
15
|
-
blockName: blockName,
|
|
16
|
-
});
|
|
17
9
|
const onClick = () => {
|
|
18
10
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
19
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
20
11
|
};
|
|
21
12
|
return (React.createElement("div", { className: b({ theme }, className) }, items.map((item) => (React.createElement("div", { className: b('item'), key: item.url },
|
|
22
13
|
React.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import React, { Fragment, useContext } from 'react';
|
|
2
2
|
import { Icon } from '@gravity-ui/uikit';
|
|
3
3
|
import { block, getLinkProps, setUrlTld } from '../../utils';
|
|
4
|
-
import { PredefinedEventTypes, } from '../../models';
|
|
5
4
|
import { Chevron } from '../../icons';
|
|
6
5
|
import FileLink from '../FileLink/FileLink';
|
|
7
6
|
import BackLink from '../BackLink/BackLink';
|
|
8
7
|
import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
9
8
|
import { LocationContext } from '../../context/locationContext/locationContext';
|
|
10
9
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
11
|
-
import { useAnalytics } from '../../hooks';
|
|
12
10
|
import './Link.css';
|
|
13
11
|
const b = block('link-block');
|
|
14
12
|
const WORD_JOINER_SYM = '\u200b';
|
|
15
|
-
const COMPONENT_NAME = 'link';
|
|
16
13
|
function getArrowSize(size) {
|
|
17
14
|
switch (size) {
|
|
18
15
|
case 'l':
|
|
@@ -26,25 +23,19 @@ function getArrowSize(size) {
|
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
const LinkBlock = (props) => {
|
|
29
|
-
const { text, url, arrow, metrikaGoals, pixelEvents,
|
|
26
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, } = props;
|
|
30
27
|
const handleMetrika = useMetrika();
|
|
31
|
-
const handleAnalytics = useAnalytics({
|
|
32
|
-
name: 'link-click',
|
|
33
|
-
type: PredefinedEventTypes.Default,
|
|
34
|
-
blockName: blockName,
|
|
35
|
-
});
|
|
36
28
|
const { hostname } = useContext(LocationContext);
|
|
37
29
|
const { tld } = useContext(LocaleContext);
|
|
38
30
|
const href = setUrlTld(props.url, tld);
|
|
39
31
|
const defaultTextSize = theme === 'back' ? 'l' : 'm';
|
|
40
32
|
const onClick = () => {
|
|
41
33
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
42
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
43
34
|
};
|
|
44
35
|
const getLinkByType = () => {
|
|
45
36
|
switch (theme) {
|
|
46
37
|
case 'back':
|
|
47
|
-
return
|
|
38
|
+
return React.createElement(BackLink, { title: children || text, url: href, onClick: onClick });
|
|
48
39
|
case 'file-link':
|
|
49
40
|
case 'underline':
|
|
50
41
|
return (React.createElement(FileLink, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick }));
|
|
@@ -6,10 +6,9 @@ import Video from './Video/Video';
|
|
|
6
6
|
import YoutubeBlock from '../VideoBlock/VideoBlock';
|
|
7
7
|
import './Media.css';
|
|
8
8
|
const b = block('Media');
|
|
9
|
-
const COMPONENT_NAME = 'media-component';
|
|
10
9
|
export const Media = (props) => {
|
|
11
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika,
|
|
12
|
-
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName,
|
|
10
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, } = props;
|
|
11
|
+
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
13
12
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
14
13
|
const content = useMemo(() => {
|
|
15
14
|
let result = [];
|
|
@@ -17,10 +16,10 @@ export const Media = (props) => {
|
|
|
17
16
|
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
18
17
|
}
|
|
19
18
|
if (video) {
|
|
20
|
-
result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika,
|
|
19
|
+
result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
21
20
|
}
|
|
22
21
|
if (youtube) {
|
|
23
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
22
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullScreen: fullScreen }));
|
|
24
23
|
}
|
|
25
24
|
if (dataLens) {
|
|
26
25
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -38,13 +37,12 @@ export const Media = (props) => {
|
|
|
38
37
|
hasVideoFallback,
|
|
39
38
|
videoClassName,
|
|
40
39
|
metrika,
|
|
41
|
-
analyticsEvents,
|
|
42
40
|
playVideo,
|
|
43
41
|
previewImg,
|
|
44
42
|
playButton,
|
|
45
43
|
customBarControlsClassName,
|
|
46
|
-
blockName,
|
|
47
44
|
youtubeClassName,
|
|
45
|
+
fullScreen,
|
|
48
46
|
]);
|
|
49
47
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
50
48
|
};
|
|
@@ -5,9 +5,8 @@ import { getVideoTypesWithPriority } from './utils';
|
|
|
5
5
|
import { block } from '../../../utils';
|
|
6
6
|
import './Video.css';
|
|
7
7
|
const b = block('media-component-video');
|
|
8
|
-
const COMPONENT_NAME = 'media-video';
|
|
9
8
|
const Video = (props) => {
|
|
10
|
-
const { video, height, metrika,
|
|
9
|
+
const { video, height, metrika, previewImg, playButton: commonPlayButton, customBarControlsClassName, videoClassName, playVideo, setHasVideoFallback, hasVideoFallback, } = props;
|
|
11
10
|
const ref = useRef(null);
|
|
12
11
|
useEffect(() => {
|
|
13
12
|
if (ref && ref.current) {
|
|
@@ -30,18 +29,16 @@ const Video = (props) => {
|
|
|
30
29
|
}, [playVideo, video, setHasVideoFallback]);
|
|
31
30
|
const reactPlayerBlock = useMemo(() => {
|
|
32
31
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
33
|
-
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika,
|
|
32
|
+
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
|
|
34
33
|
}, [
|
|
35
34
|
video,
|
|
35
|
+
height,
|
|
36
36
|
videoClassName,
|
|
37
37
|
previewImg,
|
|
38
38
|
playVideo,
|
|
39
39
|
commonPlayButton,
|
|
40
40
|
customBarControlsClassName,
|
|
41
41
|
metrika,
|
|
42
|
-
analyticsEvents,
|
|
43
|
-
height,
|
|
44
|
-
blockName,
|
|
45
42
|
]);
|
|
46
43
|
const defaultVideoBlock = useMemo(() => {
|
|
47
44
|
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-meta-info {
|
|
4
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
5
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
font-weight: 500;
|
|
9
|
+
color: var(--pc-media-card-meta-info-color);
|
|
10
|
+
}
|
|
11
|
+
.pc-meta-info__item:not(:first-child) {
|
|
12
|
+
margin-left: 16px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { block } from '../../utils';
|
|
3
|
+
import './MetaInfo.css';
|
|
4
|
+
const b = block('meta-info');
|
|
5
|
+
const MetaInfo = ({ items, className }) => (React.createElement("div", { className: b(null, className) }, items.map((metaInfoItem) => (React.createElement("div", { key: metaInfoItem, className: b('item') }, metaInfoItem)))));
|
|
6
|
+
export default MetaInfo;
|
|
@@ -3,22 +3,20 @@ import ReactPlayer from 'react-player';
|
|
|
3
3
|
import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { Icon } from '@gravity-ui/uikit';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
|
-
import { PlayButtonThemes, PlayButtonType, MediaVideoControlsType,
|
|
6
|
+
import { PlayButtonThemes, PlayButtonType, MediaVideoControlsType, } from '../../models';
|
|
7
7
|
import CustomBarControls from './CustomBarControls';
|
|
8
8
|
import { VideoContext } from '../../context/videoContext';
|
|
9
9
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
10
10
|
import { MobileContext } from '../../context/mobileContext';
|
|
11
11
|
import { PlayVideo } from '../../icons';
|
|
12
|
-
import { useAnalytics } from '../../hooks';
|
|
13
12
|
import './ReactPlayer.css';
|
|
14
13
|
const b = block('ReactPlayer');
|
|
15
14
|
const FPS = 60;
|
|
16
|
-
const COMPONENT_NAME = 'react-player';
|
|
17
15
|
// eslint-disable-next-line react/display-name
|
|
18
16
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
19
17
|
const isMobile = useContext(MobileContext);
|
|
20
18
|
const { metrika } = useContext(MetrikaContext);
|
|
21
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika,
|
|
19
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
22
20
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
23
21
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
24
22
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -33,11 +31,6 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
33
31
|
const [started, setStarted] = useState(autoPlay);
|
|
34
32
|
const [paused, setPaused] = useState(false);
|
|
35
33
|
const [ended, setEnded] = useState(false);
|
|
36
|
-
const handleAnalytics = useAnalytics({
|
|
37
|
-
name: 'react-player-controls-click',
|
|
38
|
-
type: PredefinedEventTypes.Default,
|
|
39
|
-
blockName: blockName,
|
|
40
|
-
});
|
|
41
34
|
useImperativeHandle(originRef, () => ({
|
|
42
35
|
pause: () => setIsPlaying(false),
|
|
43
36
|
}));
|
|
@@ -86,8 +79,6 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
86
79
|
window.removeEventListener('resize', updateSize);
|
|
87
80
|
};
|
|
88
81
|
}, []);
|
|
89
|
-
const playEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === PredefinedEventTypes.Play), [analyticsEvents]);
|
|
90
|
-
const stopEvents = useMemo(() => analyticsEvents === null || analyticsEvents === void 0 ? void 0 : analyticsEvents.filter((e) => e.type === PredefinedEventTypes.Stop), [analyticsEvents]);
|
|
91
82
|
const playIcon = useMemo(() => {
|
|
92
83
|
let playButtonContent;
|
|
93
84
|
switch (type) {
|
|
@@ -113,14 +104,12 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
113
104
|
metrika.reachGoals(goal, counterName);
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
|
-
const events = isMuted ? playEvents : stopEvents;
|
|
117
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(events);
|
|
118
107
|
if (isMuted) {
|
|
119
108
|
setProps({ playingVideoRef: ref.current });
|
|
120
109
|
}
|
|
121
110
|
// In order to the progress bar to update (equals 0) before displaying
|
|
122
111
|
setTimeout(() => setMuted(!isMuted), 0);
|
|
123
|
-
}, [playerRef,
|
|
112
|
+
}, [playerRef, setProps, videoMetrika, metrika]);
|
|
124
113
|
const handleClick = useCallback(() => changeMute(muted), [changeMute, muted]);
|
|
125
114
|
const handleClickPreview = useCallback(() => {
|
|
126
115
|
setIsPlaying(true);
|
|
@@ -131,8 +120,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
131
120
|
metrika.reachGoals(play, counterName);
|
|
132
121
|
}
|
|
133
122
|
}
|
|
134
|
-
|
|
135
|
-
}, [onClickPreview, metrika, videoMetrika, handleAnalytics, playEvents]);
|
|
123
|
+
}, [onClickPreview, setIsPlaying, videoMetrika, metrika]);
|
|
136
124
|
const onPause = useCallback(() => {
|
|
137
125
|
// For support correct state for youtube
|
|
138
126
|
setIsPlaying(false);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
import { Icon } from '@gravity-ui/uikit';
|
|
4
5
|
import { block, getPageSearchParams } from '../../utils';
|
|
5
6
|
import Image from '../Image/Image';
|
|
@@ -15,7 +16,6 @@ export const AUTOPLAY_ATTRIBUTES = {
|
|
|
15
16
|
mute: 1,
|
|
16
17
|
};
|
|
17
18
|
const b = block('VideoBlock');
|
|
18
|
-
const iframeId = 'video-block';
|
|
19
19
|
function getVideoSrc(stream, record) {
|
|
20
20
|
if (!stream && !record) {
|
|
21
21
|
return null;
|
|
@@ -34,14 +34,14 @@ export function getHeight(width) {
|
|
|
34
34
|
return (width / 16) * 9;
|
|
35
35
|
}
|
|
36
36
|
const VideoBlock = (props) => {
|
|
37
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height } = props;
|
|
37
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
|
|
38
38
|
const src = getVideoSrc(stream, record);
|
|
39
39
|
const ref = useRef(null);
|
|
40
40
|
const iframeRef = useRef();
|
|
41
41
|
const [hidePreview, setHidePreview] = useState(false);
|
|
42
42
|
const norender = (!stream && !record) || !src;
|
|
43
43
|
const [currentHeight, setCurrentHeight] = useState(height || undefined);
|
|
44
|
-
const fullId =
|
|
44
|
+
const fullId = id || uuidv4();
|
|
45
45
|
const onPreviewClick = useCallback(() => {
|
|
46
46
|
if (iframeRef.current) {
|
|
47
47
|
iframeRef.current.src = `${src}?${getPageSearchParams(Object.assign(Object.assign({}, AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
|
|
@@ -62,12 +62,8 @@ const VideoBlock = (props) => {
|
|
|
62
62
|
if (norender) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
const prevPageVideo = document.getElementById(fullId);
|
|
66
65
|
const fullSrc = `${src}?${getPageSearchParams(attributes || {})}`;
|
|
67
|
-
if (
|
|
68
|
-
prevPageVideo.src = fullSrc;
|
|
69
|
-
}
|
|
70
|
-
else if (ref.current) {
|
|
66
|
+
if (ref.current && !iframeRef.current) {
|
|
71
67
|
const iframe = document.createElement('iframe');
|
|
72
68
|
iframe.id = fullId;
|
|
73
69
|
iframe.src = fullSrc;
|
|
@@ -79,14 +75,14 @@ const VideoBlock = (props) => {
|
|
|
79
75
|
ref.current.appendChild(iframe);
|
|
80
76
|
iframeRef.current = iframe;
|
|
81
77
|
}
|
|
82
|
-
}, [stream, record, norender, src, fullId, attributes, iframeRef]);
|
|
78
|
+
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
|
|
83
79
|
useEffect(() => {
|
|
84
80
|
setHidePreview(false);
|
|
85
81
|
}, [src, setHidePreview]);
|
|
86
82
|
if (norender) {
|
|
87
83
|
return null;
|
|
88
84
|
}
|
|
89
|
-
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
85
|
+
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
90
86
|
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
91
87
|
playButton || (React.createElement("button", { className: b('button') },
|
|
92
88
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PixelEvent } from '../../models';
|
|
2
|
-
import { AnalyticsEvent } from '../../models/common';
|
|
3
2
|
export declare const YANDEX_FORM_ORIGIN = "https://forms.yandex.ru";
|
|
4
3
|
export interface YandexFormProps {
|
|
5
4
|
id: number | string;
|
|
@@ -15,8 +14,6 @@ export interface YandexFormProps {
|
|
|
15
14
|
onLoad?: () => void;
|
|
16
15
|
metrikaGoals?: string | string[];
|
|
17
16
|
pixelEvents?: string | string[] | PixelEvent | PixelEvent[];
|
|
18
|
-
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
19
|
-
blockName?: string;
|
|
20
17
|
}
|
|
21
18
|
declare const YandexForm: (props: YandexFormProps) => JSX.Element;
|
|
22
19
|
export default YandexForm;
|
|
@@ -4,23 +4,15 @@ import { LocaleContext } from '../../context/localeContext';
|
|
|
4
4
|
import { MobileContext } from '../../context/mobileContext';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
6
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
7
|
-
import { PredefinedEventTypes } from '../../models/common';
|
|
8
|
-
import { useAnalytics } from '../../hooks';
|
|
9
7
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
10
8
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
11
|
-
const COMPONENT_NAME = 'yandex-form';
|
|
12
9
|
const b = block('yandex-form');
|
|
13
10
|
const YandexForm = (props) => {
|
|
14
|
-
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents,
|
|
11
|
+
const { onLoad, id, params, className, theme, containerId = CONTAINER_ID, headerHeight = HEADER_HEIGHT, onSubmit, metrikaGoals, pixelEvents, customFormOrigin, } = props;
|
|
15
12
|
const formContainerRef = useRef(null);
|
|
16
13
|
const iframeRef = useRef();
|
|
17
14
|
const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;
|
|
18
15
|
const handleMetrika = useMetrika();
|
|
19
|
-
const handleAnalytics = useAnalytics({
|
|
20
|
-
name: 'yndex-form-submit',
|
|
21
|
-
type: PredefinedEventTypes.Default,
|
|
22
|
-
blockName: blockName,
|
|
23
|
-
});
|
|
24
16
|
const isMobile = useContext(MobileContext);
|
|
25
17
|
const locale = useContext(LocaleContext);
|
|
26
18
|
const updateFormIframe = useCallback((container) => {
|
|
@@ -61,19 +53,10 @@ const YandexForm = (props) => {
|
|
|
61
53
|
window.scrollBy(0, top - headerHeight);
|
|
62
54
|
}
|
|
63
55
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
64
|
-
handleAnalytics === null || handleAnalytics === void 0 ? void 0 : handleAnalytics(analyticsEvents);
|
|
65
56
|
if (onSubmit) {
|
|
66
57
|
onSubmit();
|
|
67
58
|
}
|
|
68
|
-
}, [
|
|
69
|
-
handleMetrika,
|
|
70
|
-
metrikaGoals,
|
|
71
|
-
pixelEvents,
|
|
72
|
-
handleAnalytics,
|
|
73
|
-
analyticsEvents,
|
|
74
|
-
onSubmit,
|
|
75
|
-
headerHeight,
|
|
76
|
-
]);
|
|
59
|
+
}, [handleMetrika, metrikaGoals, pixelEvents, onSubmit, headerHeight]);
|
|
77
60
|
const handleMessage = useCallback(({ origin, data }) => {
|
|
78
61
|
if (origin !== yaFormOrigin) {
|
|
79
62
|
return;
|
|
@@ -33,4 +33,6 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
|
|
|
33
33
|
export { default as Author } from './Author/Author';
|
|
34
34
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
35
35
|
export { default as HTML } from './HTML/HTML';
|
|
36
|
+
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
37
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullScreenMedia';
|
|
36
38
|
export type { RouterLinkProps } from './RouterLink/RouterLink';
|
|
@@ -33,3 +33,5 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
|
|
|
33
33
|
export { default as Author } from './Author/Author';
|
|
34
34
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
35
35
|
export { default as HTML } from './HTML/HTML';
|
|
36
|
+
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
37
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullScreenMedia';
|