@gravity-ui/page-constructor 3.0.0-alpha.6 → 4.0.0-beta.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 +21 -0
- package/README.md +1 -1
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/schema.js +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +9 -13
- package/build/cjs/blocks/Header/schema.d.ts +9 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/schema.d.ts +6 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +3 -3
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +7 -7
- package/build/cjs/components/FullscreenImage/i18n/index.js +1 -1
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +5 -5
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.js +10 -0
- package/build/cjs/components/Media/Image/Image.d.ts +1 -0
- package/build/cjs/components/Media/Image/Image.js +10 -3
- package/build/cjs/components/Media/Media.js +25 -5
- package/build/cjs/components/Media/Video/Video.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +3 -3
- package/build/cjs/components/index.d.ts +1 -1
- package/build/cjs/components/index.js +3 -3
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/icons/Fullscreen.d.ts +2 -0
- package/build/cjs/icons/{FullScreen.js → Fullscreen.js} +3 -3
- package/build/cjs/icons/index.d.ts +1 -1
- package/build/cjs/icons/index.js +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/cjs/schema/validators/common.d.ts +3 -0
- package/build/cjs/schema/validators/common.js +3 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -4
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -1
- package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/cjs/sub-blocks/LayoutItem/utils.js +6 -6
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +3 -0
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +2 -2
- package/build/esm/blocks/CardLayout/schema.js +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js +10 -14
- package/build/esm/blocks/Header/schema.d.ts +9 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/esm/blocks/Media/schema.d.ts +6 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/Tabs.js +2 -2
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +4 -4
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -9
- package/build/esm/components/FullscreenImage/i18n/index.js +1 -1
- package/build/esm/components/FullscreenMedia/FullscreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +7 -7
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.js +7 -0
- package/build/esm/components/Media/Image/Image.d.ts +1 -0
- package/build/esm/components/Media/Image/Image.js +12 -5
- package/build/esm/components/Media/Media.js +25 -5
- package/build/esm/components/Media/Video/Video.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +3 -3
- package/build/esm/components/index.d.ts +1 -1
- package/build/esm/components/index.js +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/icons/Fullscreen.d.ts +2 -0
- package/build/esm/icons/{FullScreen.js → Fullscreen.js} +1 -1
- package/build/esm/icons/index.d.ts +1 -1
- package/build/esm/icons/index.js +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/common.d.ts +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/esm/schema/validators/common.d.ts +3 -0
- package/build/esm/schema/validators/common.js +3 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +6 -6
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -1
- package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/esm/sub-blocks/LayoutItem/utils.js +3 -3
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +3 -0
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +1 -1
- package/server/models/constructor-items/common.d.ts +1 -1
- package/server/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +0 -9
- package/build/cjs/icons/FullScreen.d.ts +0 -2
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +0 -10
- package/build/esm/icons/FullScreen.d.ts +0 -2
- /package/build/cjs/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
- /package/build/esm/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
package/build/cjs/icons/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./ArrowConstructor"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./ArrowSidebar"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./Chevron"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./
|
|
7
|
+
tslib_1.__exportStar(require("./Fullscreen"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./Github"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./NavigationChevron"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./PlayVideo"), exports);
|
|
@@ -212,7 +212,7 @@ export interface TabsBlockProps extends Animatable {
|
|
|
212
212
|
items: TabsBlockItem[];
|
|
213
213
|
}
|
|
214
214
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
215
|
-
title
|
|
215
|
+
title?: TitleItemProps | string;
|
|
216
216
|
description?: string;
|
|
217
217
|
colSizes?: GridColumnSizesType;
|
|
218
218
|
}
|
|
@@ -169,7 +169,7 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
|
169
169
|
export interface MediaComponentYoutubeProps {
|
|
170
170
|
youtube: string;
|
|
171
171
|
previewImg?: string;
|
|
172
|
-
|
|
172
|
+
fullscreen?: boolean;
|
|
173
173
|
}
|
|
174
174
|
export interface MediaComponentImageProps {
|
|
175
175
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LayoutItemProps } from '../../models';
|
|
2
|
-
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border,
|
|
2
|
+
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullscreen, className, }: LayoutItemProps) => JSX.Element;
|
|
3
3
|
export default LayoutItem;
|
|
@@ -8,11 +8,11 @@ const utils_1 = require("../../utils");
|
|
|
8
8
|
const utils_2 = require("./utils");
|
|
9
9
|
const b = (0, utils_1.block)('layout-item');
|
|
10
10
|
const LayoutItem = (_a) => {
|
|
11
|
-
var _b = _a.content, { links } = _b, content = tslib_1.__rest(_b, ["links"]), { metaInfo, media, border,
|
|
11
|
+
var _b = _a.content, { links } = _b, content = tslib_1.__rest(_b, ["links"]), { metaInfo, media, border, fullscreen, className } = _a;
|
|
12
12
|
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
13
|
-
|
|
14
|
-
var { className: mediaClassName } = _a,
|
|
15
|
-
return (react_1.default.createElement(components_1.Media, Object.assign({}, media,
|
|
13
|
+
fullscreen && (0, utils_2.hasFullscreen)(media) ? (react_1.default.createElement(components_1.FullscreenMedia, { showFullscreenIcon: (0, utils_2.showFullscreenIcon)(media) }, (_a = {}) => {
|
|
14
|
+
var { className: mediaClassName, fullscreen: _fullscreen } = _a, fullscreenMediaProps = tslib_1.__rest(_a, ["className", "fullscreen"]);
|
|
15
|
+
return (react_1.default.createElement(components_1.Media, Object.assign({}, media, fullscreenMediaProps, { className: b('media', { border }, mediaClassName) })));
|
|
16
16
|
})) : (react_1.default.createElement(components_1.Media, Object.assign({}, media, { className: b('media', { border }) }))),
|
|
17
17
|
metaInfo && react_1.default.createElement(components_1.MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
18
18
|
react_1.default.createElement("div", { className: b('content') },
|
|
@@ -132,6 +132,9 @@ export declare const LayoutItem: {
|
|
|
132
132
|
type: string;
|
|
133
133
|
})[];
|
|
134
134
|
};
|
|
135
|
+
fullscreen: {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
135
138
|
};
|
|
136
139
|
content: Partial<{
|
|
137
140
|
title: {
|
|
@@ -209,7 +212,7 @@ export declare const LayoutItem: {
|
|
|
209
212
|
border: {
|
|
210
213
|
type: string;
|
|
211
214
|
};
|
|
212
|
-
|
|
215
|
+
fullscreen: {
|
|
213
216
|
type: string;
|
|
214
217
|
};
|
|
215
218
|
type: {};
|
|
@@ -12,7 +12,7 @@ exports.LayoutItem = {
|
|
|
12
12
|
required: ['content', 'media'],
|
|
13
13
|
properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0, lodash_1.omit)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
|
|
14
14
|
type: 'boolean',
|
|
15
|
-
},
|
|
15
|
+
}, fullscreen: {
|
|
16
16
|
type: 'boolean',
|
|
17
17
|
} }),
|
|
18
18
|
};
|
|
@@ -24,5 +24,5 @@ export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['lin
|
|
|
24
24
|
}[] | undefined;
|
|
25
25
|
className?: string | undefined;
|
|
26
26
|
}[] | undefined;
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
27
|
+
export declare const hasFullscreen: ({ dataLens, image }: MediaProps) => boolean;
|
|
28
|
+
export declare const showFullscreenIcon: ({ youtube }: MediaProps) => boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.showFullscreenIcon = exports.hasFullscreen = exports.getLayoutItemLinks = void 0;
|
|
4
4
|
const getLayoutItemLinks = (links) => links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign({ theme: 'normal' }, link)));
|
|
5
5
|
exports.getLayoutItemLinks = getLayoutItemLinks;
|
|
6
|
-
const
|
|
7
|
-
// datalens and slider media card don't support
|
|
6
|
+
const hasFullscreen = ({ dataLens, image }) => {
|
|
7
|
+
// datalens and slider media card don't support fullscreen mode
|
|
8
8
|
return !(dataLens || Array.isArray(image));
|
|
9
9
|
};
|
|
10
|
-
exports.
|
|
11
|
-
const
|
|
12
|
-
exports.
|
|
10
|
+
exports.hasFullscreen = hasFullscreen;
|
|
11
|
+
const showFullscreenIcon = ({ youtube }) => !youtube;
|
|
12
|
+
exports.showFullscreenIcon = showFullscreenIcon;
|
|
@@ -10,6 +10,6 @@ const DEFAULT_SIZES = {
|
|
|
10
10
|
};
|
|
11
11
|
const b = block('card-layout-block');
|
|
12
12
|
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, }) => (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
13
|
-
React.createElement(Title, { title: title, subtitle: description }),
|
|
13
|
+
(title || description) && React.createElement(Title, { title: title, subtitle: description }),
|
|
14
14
|
React.createElement(Row, null, React.Children.map(children, (child, index) => (React.createElement(Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
|
|
15
15
|
export default CardLayout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const CardLayoutProps: {
|
|
2
2
|
additionalProperties: boolean;
|
|
3
|
-
required:
|
|
3
|
+
required: never[];
|
|
4
4
|
properties: {
|
|
5
5
|
colSizes: {
|
|
6
6
|
type: string;
|
|
@@ -76,7 +76,7 @@ export declare const CardLayoutProps: {
|
|
|
76
76
|
export declare const CardLayoutBlock: {
|
|
77
77
|
'card-layout-block': {
|
|
78
78
|
additionalProperties: boolean;
|
|
79
|
-
required:
|
|
79
|
+
required: never[];
|
|
80
80
|
properties: {
|
|
81
81
|
colSizes: {
|
|
82
82
|
type: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimatableProps, BlockBaseProps, BlockHeaderProps, ChildrenCardsProps, containerSizesObject, } from '../../schema/validators/common';
|
|
2
2
|
export const CardLayoutProps = {
|
|
3
3
|
additionalProperties: false,
|
|
4
|
-
required: [
|
|
4
|
+
required: [],
|
|
5
5
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BlockBaseProps), AnimatableProps), BlockHeaderProps), { colSizes: containerSizesObject, children: ChildrenCardsProps }),
|
|
6
6
|
};
|
|
7
7
|
export const CardLayoutBlock = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { CardLayoutBlock } from '..';
|
|
2
3
|
import { AnimateBlock, Title } from '../../components';
|
|
3
4
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
4
|
-
import {
|
|
5
|
+
import { ConstructorItem } from '../../containers/PageConstructor/components/ConstructorItem';
|
|
5
6
|
import { Col, Row } from '../../grid';
|
|
6
|
-
import {
|
|
7
|
-
import { block } from '../../utils';
|
|
7
|
+
import { block, getBlockKey } from '../../utils';
|
|
8
8
|
import i18n from './i18n';
|
|
9
9
|
import './FilterBlock.css';
|
|
10
10
|
const b = block('filter-block');
|
|
@@ -22,25 +22,21 @@ const FilterBlock = ({ title, description, tags, tagButtonSize, allTag, items, c
|
|
|
22
22
|
? tabButtons[0].id
|
|
23
23
|
: selectedTag;
|
|
24
24
|
}, [tabButtons, selectedTag]);
|
|
25
|
-
const
|
|
25
|
+
const cards = useMemo(() => {
|
|
26
26
|
const itemsToShow = actualTag
|
|
27
27
|
? items.filter((item) => item.tags.includes(actualTag))
|
|
28
28
|
: items;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
type: BlockType.CardLayoutBlock,
|
|
32
|
-
title: '',
|
|
33
|
-
colSizes: colSizes,
|
|
34
|
-
children: itemsToShow.map((item) => item.card),
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
}, [actualTag, items, colSizes]);
|
|
29
|
+
return itemsToShow.map((item) => item.card);
|
|
30
|
+
}, [actualTag, items]);
|
|
38
31
|
return (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
39
32
|
title && (React.createElement(Title, { className: b('title', { centered: centered }), title: title, subtitle: description })),
|
|
40
33
|
tabButtons.length && (React.createElement(Row, null,
|
|
41
34
|
React.createElement(Col, null,
|
|
42
35
|
React.createElement(ButtonTabs, { className: b('tabs', { centered: centered }), items: tabButtons, activeTab: selectedTag, onSelectTab: setSelectedTag, tabSize: tagButtonSize })))),
|
|
43
36
|
React.createElement(Row, { className: b('block-container') },
|
|
44
|
-
React.createElement(
|
|
37
|
+
React.createElement(CardLayoutBlock, { title: "", colSizes: colSizes }, cards.map((card, index) => {
|
|
38
|
+
const key = getBlockKey(card, index);
|
|
39
|
+
return React.createElement(ConstructorItem, { data: card, blockKey: key, key: key });
|
|
40
|
+
})))));
|
|
45
41
|
};
|
|
46
42
|
export default FilterBlock;
|
|
@@ -137,6 +137,9 @@ export declare const HeaderBackgroundProps: {
|
|
|
137
137
|
type: string;
|
|
138
138
|
})[];
|
|
139
139
|
};
|
|
140
|
+
fullscreen: {
|
|
141
|
+
type: string;
|
|
142
|
+
};
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
145
|
export declare const HeaderProperties: {
|
|
@@ -424,6 +427,9 @@ export declare const HeaderProperties: {
|
|
|
424
427
|
type: string;
|
|
425
428
|
})[];
|
|
426
429
|
};
|
|
430
|
+
fullscreen: {
|
|
431
|
+
type: string;
|
|
432
|
+
};
|
|
427
433
|
};
|
|
428
434
|
} | {
|
|
429
435
|
type: string;
|
|
@@ -757,6 +763,9 @@ export declare const HeaderBlock: {
|
|
|
757
763
|
type: string;
|
|
758
764
|
})[];
|
|
759
765
|
};
|
|
766
|
+
fullscreen: {
|
|
767
|
+
type: string;
|
|
768
|
+
};
|
|
760
769
|
};
|
|
761
770
|
} | {
|
|
762
771
|
type: string;
|
|
@@ -131,6 +131,9 @@ export declare const Media: {
|
|
|
131
131
|
type: string;
|
|
132
132
|
})[];
|
|
133
133
|
};
|
|
134
|
+
fullscreen: {
|
|
135
|
+
type: string;
|
|
136
|
+
};
|
|
134
137
|
};
|
|
135
138
|
};
|
|
136
139
|
export declare const MediaBlockBaseProps: {
|
|
@@ -608,6 +611,9 @@ export declare const MediaBlock: {
|
|
|
608
611
|
type: string;
|
|
609
612
|
})[];
|
|
610
613
|
};
|
|
614
|
+
fullscreen: {
|
|
615
|
+
type: string;
|
|
616
|
+
};
|
|
611
617
|
};
|
|
612
618
|
};
|
|
613
619
|
description: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useRef, useState } from 'react';
|
|
2
2
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
3
3
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
4
|
-
import
|
|
4
|
+
import FullscreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
5
5
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
6
6
|
import Media from '../../components/Media/Media';
|
|
7
7
|
import Title from '../../components/Title/Title';
|
|
@@ -44,7 +44,7 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
44
44
|
}, className: b('col', { centered: centered }) },
|
|
45
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
46
|
imageProps && (React.createElement(Fragment, null,
|
|
47
|
-
React.createElement(
|
|
47
|
+
React.createElement(FullscreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
|
|
48
48
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && React.createElement("p", { className: b('caption') }, activeTabData.caption)));
|
|
49
49
|
const onSelectTab = (id, e) => {
|
|
50
50
|
setActiveTab(id);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-
|
|
3
|
+
.pc-fullscreen-image__image {
|
|
4
4
|
cursor: pointer;
|
|
5
5
|
}
|
|
6
|
-
.pc-
|
|
6
|
+
.pc-fullscreen-image__image-wrapper {
|
|
7
7
|
position: relative;
|
|
8
8
|
}
|
|
9
|
-
.pc-
|
|
9
|
+
.pc-fullscreen-image__modal-content {
|
|
10
10
|
position: relative;
|
|
11
11
|
}
|
|
12
|
-
.pc-
|
|
12
|
+
.pc-fullscreen-image__modal-image {
|
|
13
13
|
display: block;
|
|
14
14
|
max-width: 1232px;
|
|
15
15
|
max-height: 70vh;
|
|
16
16
|
overflow: hidden;
|
|
17
17
|
}
|
|
18
|
-
.pc-
|
|
18
|
+
.pc-fullscreen-image__modal .yc-modal__content, .pc-fullscreen-image__modal-image {
|
|
19
19
|
border-radius: var(--pc-border-radius);
|
|
20
20
|
}
|
|
21
|
-
.pc-
|
|
21
|
+
.pc-fullscreen-image__icon-wrapper {
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: center;
|
|
24
24
|
justify-content: center;
|
|
@@ -33,28 +33,28 @@ unpredictable css rules order in build */
|
|
|
33
33
|
opacity: 0;
|
|
34
34
|
transition: 0.3s;
|
|
35
35
|
}
|
|
36
|
-
.pc-
|
|
36
|
+
.pc-fullscreen-image__icon-wrapper_visible {
|
|
37
37
|
opacity: 1;
|
|
38
38
|
}
|
|
39
|
-
.pc-
|
|
39
|
+
.pc-fullscreen-image__icon {
|
|
40
40
|
color: var(--yc-color-text-hint);
|
|
41
41
|
}
|
|
42
|
-
.pc-
|
|
42
|
+
.pc-fullscreen-image__icon_hover:hover {
|
|
43
43
|
color: var(--yc-color-text-secondary);
|
|
44
44
|
}
|
|
45
45
|
@media (max-width: 1185px) {
|
|
46
|
-
.pc-
|
|
46
|
+
.pc-fullscreen-image__modal-image {
|
|
47
47
|
width: 100%;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
@media (max-width: 1081px) {
|
|
51
|
-
.pc-
|
|
51
|
+
.pc-fullscreen-image__image {
|
|
52
52
|
pointer-events: none;
|
|
53
53
|
}
|
|
54
|
-
.pc-
|
|
54
|
+
.pc-fullscreen-image__icon-wrapper {
|
|
55
55
|
display: none;
|
|
56
56
|
}
|
|
57
|
-
.pc-
|
|
57
|
+
.pc-fullscreen-image__modal {
|
|
58
58
|
display: none !important; /* stylelint-disable-line declaration-no-important */
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ImageProps } from '../Image/Image';
|
|
3
|
-
import './
|
|
4
|
-
export interface
|
|
3
|
+
import './FullscreenImage.css';
|
|
4
|
+
export interface FullscreenImageProps extends ImageProps {
|
|
5
5
|
imageClassName?: string;
|
|
6
6
|
modalImageClass?: string;
|
|
7
7
|
imageStyle?: CSSProperties;
|
|
8
8
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const FullscreenImage: (props: FullscreenImageProps) => JSX.Element;
|
|
10
|
+
export default FullscreenImage;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Icon, Modal } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { Fullscreen, PreviewClose } from '../../icons';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import Image from '../Image/Image';
|
|
6
6
|
import i18n from './i18n';
|
|
7
|
-
import './
|
|
8
|
-
const b = block('
|
|
7
|
+
import './FullscreenImage.css';
|
|
8
|
+
const b = block('fullscreen-image');
|
|
9
9
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
10
10
|
const CLOSE_ICON_SIZE = 30;
|
|
11
|
-
const
|
|
11
|
+
const FullscreenImage = (props) => {
|
|
12
12
|
const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt') } = props;
|
|
13
13
|
const [isOpened, setIsOpened] = useState(false);
|
|
14
14
|
const [isMouseEnter, setIsMouseEnter] = useState(false);
|
|
15
15
|
const openModal = () => setIsOpened(true);
|
|
16
16
|
const closeModal = () => setIsOpened(false);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const showFullscreenIcon = () => setIsMouseEnter(true);
|
|
18
|
+
const hideFullscreenIcon = () => setIsMouseEnter(false);
|
|
19
19
|
return (React.createElement("div", { className: b() },
|
|
20
|
-
React.createElement("div", { className: b('image-wrapper'), onMouseEnter:
|
|
20
|
+
React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullscreenIcon, onMouseLeave: hideFullscreenIcon },
|
|
21
21
|
React.createElement(Image, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
|
|
22
22
|
React.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
|
|
23
|
-
React.createElement(Icon, { data:
|
|
23
|
+
React.createElement(Icon, { data: Fullscreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
|
|
24
24
|
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
25
25
|
React.createElement("div", { className: b('modal-content') },
|
|
26
26
|
React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
27
27
|
React.createElement(Icon, { data: PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
28
28
|
React.createElement(Image, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
|
|
29
29
|
};
|
|
30
|
-
export default
|
|
30
|
+
export default FullscreenImage;
|
|
@@ -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;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useContext, useState } from 'react';
|
|
2
2
|
import { Icon, Modal } from '@gravity-ui/uikit';
|
|
3
3
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
|
-
import {
|
|
4
|
+
import { Fullscreen, PreviewClose } from '../../icons';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
|
-
import './
|
|
6
|
+
import './FullscreenMedia.css';
|
|
7
7
|
const b = block('full-screen-media');
|
|
8
8
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
9
9
|
const CLOSE_ICON_SIZE = 30;
|
|
10
10
|
const getMediaClass = (type) => b('modal-media', { type });
|
|
11
|
-
const
|
|
11
|
+
const FullscreenMedia = ({ children, showFullscreenIcon = true }) => {
|
|
12
12
|
const [isOpened, setIsOpened] = useState(false);
|
|
13
13
|
const isMobile = useContext(MobileContext);
|
|
14
14
|
const openModal = (e) => {
|
|
@@ -22,8 +22,8 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
|
22
22
|
return (React.createElement("div", { className: b() },
|
|
23
23
|
React.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
24
24
|
children({ className: b('inline-media') }),
|
|
25
|
-
|
|
26
|
-
React.createElement(Icon, { data:
|
|
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
27
|
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
28
28
|
React.createElement("div", { className: b('modal-content') },
|
|
29
29
|
React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
|
|
@@ -32,7 +32,7 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
|
32
32
|
imageClassName: getMediaClass('image'),
|
|
33
33
|
videoClassName: getMediaClass('video'),
|
|
34
34
|
youtubeClassName: getMediaClass('youtube'),
|
|
35
|
-
|
|
35
|
+
fullscreen: true,
|
|
36
36
|
}))))));
|
|
37
37
|
};
|
|
38
|
-
export default
|
|
38
|
+
export default FullscreenMedia;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FullscreenMedia from '../../FullscreenMedia/FullscreenMedia';
|
|
3
|
+
import Video from '../Video/Video';
|
|
4
|
+
const FullscreenVideo = (props) => {
|
|
5
|
+
return (React.createElement(FullscreenMedia, null, (classNames) => React.createElement(Video, Object.assign({}, props, classNames))));
|
|
6
|
+
};
|
|
7
|
+
export default FullscreenVideo;
|
|
@@ -5,13 +5,13 @@ import SliderBlock from '../../../blocks/Slider/Slider';
|
|
|
5
5
|
import { SliderType } from '../../../models';
|
|
6
6
|
import { block } from '../../../utils';
|
|
7
7
|
import BackgroundImage from '../../BackgroundImage/BackgroundImage';
|
|
8
|
-
import
|
|
8
|
+
import FullscreenImage from '../../FullscreenImage/FullscreenImage';
|
|
9
9
|
import ImageView from '../../Image/Image';
|
|
10
10
|
import { getMediaImage } from './utils';
|
|
11
11
|
import './Image.css';
|
|
12
12
|
const b = block('media-component-image');
|
|
13
13
|
const Image = (props) => {
|
|
14
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video } = props;
|
|
14
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, } = props;
|
|
15
15
|
const [scrollY, setScrollY] = useState(0);
|
|
16
16
|
const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
|
|
17
17
|
springScrollY: 0,
|
|
@@ -32,10 +32,10 @@ const Image = (props) => {
|
|
|
32
32
|
parallaxInterpolate = springScrollY.interpolate((value) => `translateY(-${Number(value) / parallaxLevel}px)`);
|
|
33
33
|
}
|
|
34
34
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
35
|
-
const
|
|
35
|
+
const renderFullscreenImage = (item) => {
|
|
36
36
|
const itemData = getMediaImage(item);
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
}
|
|
37
|
+
return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
38
|
+
};
|
|
39
39
|
const imageBackground = (oneImage) => {
|
|
40
40
|
const imageData = getMediaImage(oneImage);
|
|
41
41
|
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate } },
|
|
@@ -45,9 +45,16 @@ const Image = (props) => {
|
|
|
45
45
|
const imageData = getMediaImage(oneImage);
|
|
46
46
|
return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
47
47
|
};
|
|
48
|
+
const imageSlider = (imageArray) => {
|
|
49
|
+
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
50
|
+
return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))));
|
|
51
|
+
};
|
|
48
52
|
if (Array.isArray(image)) {
|
|
49
53
|
return imageSlider(image);
|
|
50
54
|
}
|
|
55
|
+
if (fullscreen) {
|
|
56
|
+
return renderFullscreenImage(image);
|
|
57
|
+
}
|
|
51
58
|
return isBackground ? imageBackground(image) : imageOnly(image);
|
|
52
59
|
};
|
|
53
60
|
export default Image;
|