@gravity-ui/page-constructor 2.20.1 → 2.22.0-alpha
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 +0 -46
- package/README.md +1 -1
- package/build/cjs/blocks/Header/schema.d.ts +18 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +6 -0
- package/build/cjs/blocks/Media/schema.d.ts +12 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
- package/build/cjs/blocks/Security/schema.d.ts +6 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +6 -0
- package/build/cjs/components/Anchor/Anchor.d.ts +2 -2
- package/build/cjs/components/Anchor/Anchor.js +1 -1
- package/build/cjs/components/Anchor/__tests__/Anchor.test.js +21 -0
- package/build/cjs/components/AnimateBlock/__tests__/AnimateBlock.test.js +36 -0
- package/build/cjs/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/cjs/components/Author/__tests__/Author.test.js +49 -0
- package/build/cjs/components/BackLink/__tests__/BackLink.test.d.ts +1 -0
- package/build/cjs/components/BackLink/__tests__/BackLink.test.js +63 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BlockBase/BlockBase.d.ts +2 -3
- package/build/cjs/components/BlockBase/BlockBase.js +2 -4
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.d.ts +1 -0
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.js +44 -0
- package/build/cjs/components/Button/Button.css +0 -3
- package/build/cjs/components/Button/Button.js +4 -5
- package/build/cjs/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/cjs/components/Button/__tests__/Button.test.js +91 -0
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +1 -0
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.js +58 -0
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -2
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +5 -5
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.d.ts +13 -0
- package/build/cjs/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +3 -3
- package/build/cjs/components/Image/Image.d.ts +0 -1
- package/build/cjs/components/Image/Image.js +2 -2
- 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 -4
- package/build/cjs/components/Media/Video/Video.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +4 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +3 -3
- package/build/cjs/components/index.d.ts +1 -1
- package/build/cjs/components/index.js +2 -2
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +3 -5
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/cjs/context/innerContext/InnerContext.d.ts +1 -2
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/internal-typings/global.d.ts +16 -18
- package/build/cjs/models/constructor-items/blocks.d.ts +11 -1
- package/build/cjs/models/constructor-items/blocks.js +2 -0
- package/build/cjs/models/constructor-items/common.d.ts +7 -3
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -0
- package/build/cjs/models/constructor.d.ts +1 -4
- package/build/cjs/models/index.d.ts +0 -1
- package/build/cjs/models/index.js +0 -1
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +6 -0
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -2
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +2 -5
- package/build/cjs/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/cjs/sub-blocks/HubspotForm/index.js +5 -6
- 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 +9 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +2 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/cjs/sub-blocks/LayoutItem/utils.js +5 -5
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +6 -0
- package/build/cjs/utils/blocks.d.ts +1 -4
- package/build/cjs/utils/blocks.js +1 -11
- package/build/esm/blocks/Header/schema.d.ts +18 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +6 -0
- package/build/esm/blocks/Media/schema.d.ts +12 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
- package/build/esm/blocks/Security/schema.d.ts +6 -0
- package/build/esm/blocks/Tabs/Tabs.js +2 -2
- package/build/esm/blocks/Tabs/schema.d.ts +6 -0
- package/build/esm/components/Anchor/Anchor.d.ts +2 -2
- package/build/esm/components/Anchor/Anchor.js +1 -1
- package/build/esm/components/Anchor/__tests__/Anchor.test.d.ts +1 -0
- package/build/esm/components/Anchor/__tests__/Anchor.test.js +18 -0
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts +1 -0
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.js +33 -0
- package/build/esm/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/esm/components/Author/__tests__/Author.test.js +46 -0
- package/build/esm/components/BackLink/__tests__/BackLink.test.d.ts +1 -0
- package/build/esm/components/BackLink/__tests__/BackLink.test.js +60 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BlockBase/BlockBase.d.ts +2 -3
- package/build/esm/components/BlockBase/BlockBase.js +2 -4
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.d.ts +1 -0
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.js +41 -0
- package/build/esm/components/Button/Button.css +0 -3
- package/build/esm/components/Button/Button.js +4 -5
- package/build/esm/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/esm/components/Button/__tests__/Button.test.js +88 -0
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +1 -0
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.js +55 -0
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +3 -3
- package/build/esm/components/FullscreenImage/FullscreenImage.js +6 -6
- package/build/esm/components/FullscreenMedia/FullscreenMedia.d.ts +14 -0
- package/build/esm/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +4 -4
- package/build/esm/components/Image/Image.d.ts +0 -1
- package/build/esm/components/Image/Image.js +2 -2
- 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 -4
- package/build/esm/components/Media/Video/Video.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +4 -0
- 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/containers/Loadable/Loadable.d.ts +2 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +4 -6
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +2 -3
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/esm/context/innerContext/InnerContext.d.ts +1 -2
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/internal-typings/global.d.ts +16 -18
- package/build/esm/models/constructor-items/blocks.d.ts +11 -1
- package/build/esm/models/constructor-items/blocks.js +2 -0
- package/build/esm/models/constructor-items/common.d.ts +7 -3
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -0
- package/build/esm/models/constructor.d.ts +1 -4
- package/build/esm/models/index.d.ts +0 -1
- package/build/esm/models/index.js +0 -1
- package/build/esm/schema/validators/common.d.ts +6 -0
- package/build/esm/schema/validators/common.js +6 -0
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -2
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +3 -6
- package/build/esm/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/esm/sub-blocks/HubspotForm/index.js +6 -7
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +5 -5
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +9 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +2 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/esm/sub-blocks/LayoutItem/utils.js +2 -2
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +6 -0
- package/build/esm/utils/blocks.d.ts +1 -4
- package/build/esm/utils/blocks.js +0 -7
- package/package.json +6 -4
- package/server/models/constructor-items/blocks.d.ts +11 -1
- package/server/models/constructor-items/blocks.js +2 -0
- package/server/models/constructor-items/common.d.ts +7 -3
- package/server/models/constructor-items/sub-blocks.d.ts +4 -0
- package/server/models/constructor.d.ts +1 -4
- package/server/models/index.d.ts +0 -1
- package/server/models/index.js +0 -1
- package/server/utils/blocks.d.ts +1 -4
- package/server/utils/blocks.js +1 -11
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +0 -9
- package/build/cjs/customization/BlockDecoration.d.ts +0 -3
- package/build/cjs/customization/BlockDecoration.js +0 -22
- package/build/cjs/editor/Components/AddBlock/AddBlock.css +0 -82
- package/build/cjs/editor/Components/AddBlock/AddBlock.d.ts +0 -7
- package/build/cjs/editor/Components/AddBlock/AddBlock.js +0 -43
- package/build/cjs/editor/Components/EditBlock/EditBlock.css +0 -47
- package/build/cjs/editor/Components/EditBlock/EditBlock.d.ts +0 -4
- package/build/cjs/editor/Components/EditBlock/EditBlock.js +0 -32
- package/build/cjs/editor/Containers/Editor.d.ts +0 -2
- package/build/cjs/editor/Containers/Editor.js +0 -24
- package/build/cjs/editor/data/index.d.ts +0 -13
- package/build/cjs/editor/data/index.js +0 -27
- package/build/cjs/editor/data/previews/default-preview.d.ts +0 -3
- package/build/cjs/editor/data/previews/default-preview.js +0 -18
- package/build/cjs/editor/data/previews/header-block.d.ts +0 -3
- package/build/cjs/editor/data/previews/header-block.js +0 -19
- package/build/cjs/editor/index.d.ts +0 -2
- package/build/cjs/editor/index.js +0 -7
- package/build/cjs/editor/store/index.d.ts +0 -15
- package/build/cjs/editor/store/index.js +0 -32
- package/build/cjs/editor/store/reducer.d.ts +0 -41
- package/build/cjs/editor/store/reducer.js +0 -59
- package/build/cjs/editor/store/utils.d.ts +0 -13
- package/build/cjs/editor/store/utils.js +0 -34
- package/build/cjs/editor/styles/mixins.css +0 -0
- package/build/cjs/editor/styles/variables.css +0 -0
- package/build/cjs/editor/types/index.d.ts +0 -17
- package/build/cjs/editor/types/index.js +0 -2
- package/build/cjs/editor/utils/index.d.ts +0 -11
- package/build/cjs/editor/utils/index.js +0 -12
- package/build/cjs/models/customization.d.ts +0 -9
- package/build/cjs/models/customization.js +0 -2
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +0 -10
- package/build/esm/customization/BlockDecoration.d.ts +0 -3
- package/build/esm/customization/BlockDecoration.js +0 -17
- package/build/esm/editor/Components/AddBlock/AddBlock.css +0 -82
- package/build/esm/editor/Components/AddBlock/AddBlock.d.ts +0 -8
- package/build/esm/editor/Components/AddBlock/AddBlock.js +0 -41
- package/build/esm/editor/Components/EditBlock/EditBlock.css +0 -47
- package/build/esm/editor/Components/EditBlock/EditBlock.d.ts +0 -5
- package/build/esm/editor/Components/EditBlock/EditBlock.js +0 -30
- package/build/esm/editor/Containers/Editor.d.ts +0 -2
- package/build/esm/editor/Containers/Editor.js +0 -20
- package/build/esm/editor/data/index.d.ts +0 -13
- package/build/esm/editor/data/index.js +0 -24
- package/build/esm/editor/data/previews/default-preview.d.ts +0 -3
- package/build/esm/editor/data/previews/default-preview.js +0 -15
- package/build/esm/editor/data/previews/header-block.d.ts +0 -3
- package/build/esm/editor/data/previews/header-block.js +0 -16
- package/build/esm/editor/index.d.ts +0 -2
- package/build/esm/editor/index.js +0 -2
- package/build/esm/editor/store/index.d.ts +0 -15
- package/build/esm/editor/store/index.js +0 -28
- package/build/esm/editor/store/reducer.d.ts +0 -41
- package/build/esm/editor/store/reducer.js +0 -55
- package/build/esm/editor/store/utils.d.ts +0 -13
- package/build/esm/editor/store/utils.js +0 -26
- package/build/esm/editor/styles/mixins.css +0 -0
- package/build/esm/editor/styles/variables.css +0 -0
- package/build/esm/editor/types/index.d.ts +0 -17
- package/build/esm/editor/utils/index.d.ts +0 -11
- package/build/esm/editor/utils/index.js +0 -6
- package/build/esm/models/customization.d.ts +0 -9
- package/server/models/customization.d.ts +0 -9
- package/server/models/customization.js +0 -2
- /package/build/{esm/editor/types/index.js → cjs/components/Anchor/__tests__/Anchor.test.d.ts} +0 -0
- /package/build/{esm/models/customization.js → cjs/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts} +0 -0
- /package/build/cjs/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +0 -0
- /package/build/cjs/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
- /package/build/esm/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +0 -0
- /package/build/esm/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BlockBaseProps, ClassNameProps } from '../../models';
|
|
1
|
+
import { BlockBaseProps, ClassNameProps, WithChildren } from '../../models';
|
|
3
2
|
import './BlockBase.css';
|
|
4
|
-
declare const BlockBase: (props:
|
|
3
|
+
declare const BlockBase: (props: WithChildren<BlockBaseProps & ClassNameProps>) => JSX.Element;
|
|
5
4
|
export default BlockBase;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BlockDecoration } from '../../customization/BlockDecoration';
|
|
3
2
|
import { Col } from '../../grid';
|
|
4
3
|
import { block } from '../../utils';
|
|
5
4
|
import Anchor from '../Anchor/Anchor';
|
|
@@ -8,8 +7,7 @@ const b = block('block-base');
|
|
|
8
7
|
const BlockBase = (props) => {
|
|
9
8
|
const { anchor, visible, children, className, resetPaddings, qa } = props;
|
|
10
9
|
return (React.createElement(Col, { className: b({ ['reset-paddings']: resetPaddings }, className), visible: visible, reset: true, dataQa: qa },
|
|
11
|
-
React.createElement(
|
|
12
|
-
|
|
13
|
-
children)));
|
|
10
|
+
anchor && React.createElement(Anchor, { id: anchor.url, className: b('anchor') }),
|
|
11
|
+
children));
|
|
14
12
|
};
|
|
15
13
|
export default BlockBase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { qaIdByDefault } from '../../../components/Anchor/Anchor';
|
|
4
|
+
import { GridColumnSize } from '../../../grid';
|
|
5
|
+
import BlockBase from '../BlockBase';
|
|
6
|
+
const qaId = 'block-base-component';
|
|
7
|
+
describe('BlockBase', () => {
|
|
8
|
+
test('render component by default', async () => {
|
|
9
|
+
render(React.createElement(BlockBase, { qa: qaId }));
|
|
10
|
+
const component = screen.getByTestId(qaId);
|
|
11
|
+
expect(component).toBeInTheDocument();
|
|
12
|
+
expect(component).toBeVisible();
|
|
13
|
+
expect(component).not.toBeDisabled();
|
|
14
|
+
});
|
|
15
|
+
test('add className', () => {
|
|
16
|
+
const className = 'my-class';
|
|
17
|
+
render(React.createElement(BlockBase, { qa: qaId, className: className }));
|
|
18
|
+
const component = screen.getByTestId(qaId);
|
|
19
|
+
expect(component).toHaveClass(className);
|
|
20
|
+
});
|
|
21
|
+
test('should reset paddings', () => {
|
|
22
|
+
render(React.createElement(BlockBase, { qa: qaId, resetPaddings: true }));
|
|
23
|
+
const component = screen.getByTestId(qaId);
|
|
24
|
+
expect(component).toHaveClass('pc-block-base_reset-paddings');
|
|
25
|
+
});
|
|
26
|
+
test.each(new Array(...Object.values(GridColumnSize)))('render with given "%s" size', (size) => {
|
|
27
|
+
render(React.createElement(BlockBase, { qa: qaId, visible: size }));
|
|
28
|
+
const component = screen.getByTestId(qaId);
|
|
29
|
+
expect(component).toHaveClass(`d-${size}-block`);
|
|
30
|
+
});
|
|
31
|
+
test('should have anchor', () => {
|
|
32
|
+
const anchor = {
|
|
33
|
+
text: 'anchor',
|
|
34
|
+
url: 'https://github.com/gravity-ui/',
|
|
35
|
+
};
|
|
36
|
+
render(React.createElement(BlockBase, { anchor: anchor }));
|
|
37
|
+
const component = screen.getByTestId(qaIdByDefault);
|
|
38
|
+
expect(component).toBeInTheDocument();
|
|
39
|
+
expect(component).toHaveAttribute('id', anchor.url);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -14,7 +14,7 @@ const b = block('button-block');
|
|
|
14
14
|
const Button = (props) => {
|
|
15
15
|
const handleMetrika = useMetrika();
|
|
16
16
|
const { lang, tld } = useContext(LocaleContext);
|
|
17
|
-
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text
|
|
17
|
+
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
18
18
|
const defaultImgPosition = 'left';
|
|
19
19
|
const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);
|
|
20
20
|
const onClick = useCallback((e) => {
|
|
@@ -24,13 +24,12 @@ const Button = (props) => {
|
|
|
24
24
|
onClickOrigin(e);
|
|
25
25
|
}
|
|
26
26
|
}, [handleMetrika, metrikaGoals, pixelEvents, handleAnalytics, analyticsEvents, onClickOrigin]);
|
|
27
|
-
const buttonModifiers = { size, theme, width };
|
|
28
27
|
const buttonImg = img instanceof Object
|
|
29
28
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
30
29
|
: { url: img, position: defaultImgPosition };
|
|
31
30
|
const buttonClass = img
|
|
32
|
-
? b(
|
|
33
|
-
: b(
|
|
31
|
+
? b({ position: buttonImg.position, size, theme }, className)
|
|
32
|
+
: b({ size, theme }, className);
|
|
34
33
|
const buttonProps = Object.assign(Object.assign({}, rest), { onClick });
|
|
35
34
|
if (theme === 'app-store' || theme === 'google-play') {
|
|
36
35
|
const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;
|
|
@@ -43,7 +42,7 @@ const Button = (props) => {
|
|
|
43
42
|
image = undefined;
|
|
44
43
|
}
|
|
45
44
|
const buttonTheme = theme === 'scale' ? 'accent' : theme;
|
|
46
|
-
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined
|
|
45
|
+
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined }, buttonProps),
|
|
47
46
|
icon && buttonImg.position === 'left' ? icon : null,
|
|
48
47
|
React.createElement("span", { className: b('content') },
|
|
49
48
|
image && buttonImg.position === 'left' ? image : null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import Button from '../Button';
|
|
5
|
+
import { ICON_QA } from '../utils';
|
|
6
|
+
const qaId = 'button-component';
|
|
7
|
+
const buttonProps = {
|
|
8
|
+
text: 'Button Text',
|
|
9
|
+
url: 'https://github.com/gravity-ui/',
|
|
10
|
+
target: '_blank',
|
|
11
|
+
img: {
|
|
12
|
+
url: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icon_1_light.svg',
|
|
13
|
+
position: 'left',
|
|
14
|
+
alt: 'alt-text',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const buttonViews = [
|
|
18
|
+
'normal',
|
|
19
|
+
'action',
|
|
20
|
+
'outlined',
|
|
21
|
+
'outlined-info',
|
|
22
|
+
'outlined-danger',
|
|
23
|
+
'raised',
|
|
24
|
+
'flat',
|
|
25
|
+
'flat-info',
|
|
26
|
+
'flat-danger',
|
|
27
|
+
'flat-secondary',
|
|
28
|
+
'normal-contrast',
|
|
29
|
+
'outlined-contrast',
|
|
30
|
+
'flat-contrast',
|
|
31
|
+
'github',
|
|
32
|
+
'scale',
|
|
33
|
+
'monochrome',
|
|
34
|
+
];
|
|
35
|
+
describe('Button', () => {
|
|
36
|
+
test('render button by default', async () => {
|
|
37
|
+
render(React.createElement(Button, { text: buttonProps.text }));
|
|
38
|
+
const button = screen.getByRole('button');
|
|
39
|
+
expect(button).toBeInTheDocument();
|
|
40
|
+
expect(button).toBeVisible();
|
|
41
|
+
expect(button).not.toBeDisabled();
|
|
42
|
+
});
|
|
43
|
+
test('should render <a /> tag', async () => {
|
|
44
|
+
render(React.createElement(Button, { text: buttonProps.text, url: buttonProps.url, target: buttonProps.target }));
|
|
45
|
+
const button = screen.getByRole('link');
|
|
46
|
+
expect(button).toBeVisible();
|
|
47
|
+
expect(button).toHaveAttribute('href', buttonProps.url);
|
|
48
|
+
expect(button).toHaveAttribute('target', buttonProps.target);
|
|
49
|
+
});
|
|
50
|
+
test('call onClick', async () => {
|
|
51
|
+
const user = userEvent.setup();
|
|
52
|
+
const handleOnClick = jest.fn();
|
|
53
|
+
render(React.createElement(Button, { text: buttonProps.text, onClick: handleOnClick }));
|
|
54
|
+
const button = screen.getByRole('button');
|
|
55
|
+
await user.click(button);
|
|
56
|
+
expect(handleOnClick).toHaveBeenCalledTimes(1);
|
|
57
|
+
});
|
|
58
|
+
test.each(new Array('s', 'm', 'l', 'xl'))('render with given "%s" size', (size) => {
|
|
59
|
+
render(React.createElement(Button, { text: buttonProps.text, size: size, qa: qaId }));
|
|
60
|
+
const button = screen.getByTestId(qaId);
|
|
61
|
+
expect(button).toHaveClass(`pc-button-block_size_${size}`);
|
|
62
|
+
});
|
|
63
|
+
test.each(new Array(...buttonViews))('render with given "%s" view', (theme) => {
|
|
64
|
+
render(React.createElement(Button, { text: buttonProps.text, theme: theme, qa: qaId }));
|
|
65
|
+
const button = screen.getByTestId(qaId);
|
|
66
|
+
expect(button).toHaveClass(`pc-button-block_theme_${theme}`);
|
|
67
|
+
});
|
|
68
|
+
test('add className', () => {
|
|
69
|
+
const className = 'my-class';
|
|
70
|
+
render(React.createElement(Button, { text: buttonProps.text, className: className, qa: qaId }));
|
|
71
|
+
const button = screen.getByTestId(qaId);
|
|
72
|
+
expect(button).toHaveClass(className);
|
|
73
|
+
});
|
|
74
|
+
test('should render icon', () => {
|
|
75
|
+
render(React.createElement(Button, { text: buttonProps.text, img: buttonProps.img }));
|
|
76
|
+
const button = screen.getByRole('button');
|
|
77
|
+
const iconComponent = screen.getByRole('img');
|
|
78
|
+
expect(iconComponent).toBeVisible();
|
|
79
|
+
expect(button).toContainElement(iconComponent);
|
|
80
|
+
});
|
|
81
|
+
test('should render github icon', () => {
|
|
82
|
+
render(React.createElement(Button, { text: buttonProps.text, img: buttonProps.img, theme: "github" }));
|
|
83
|
+
const button = screen.getByRole('button');
|
|
84
|
+
const iconComponent = screen.getByTestId(ICON_QA);
|
|
85
|
+
expect(iconComponent).toBeVisible();
|
|
86
|
+
expect(button).toContainElement(iconComponent);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import ButtonTabs from '../ButtonTabs';
|
|
5
|
+
const qaId = 'button-tabs-component';
|
|
6
|
+
const items = [
|
|
7
|
+
{
|
|
8
|
+
id: '0',
|
|
9
|
+
title: 'tab-1',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: '1',
|
|
13
|
+
title: 'tab-2',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '2',
|
|
17
|
+
title: 'tab-3',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
describe('ButtonTabs', () => {
|
|
21
|
+
test('render ButtonTabs by default', async () => {
|
|
22
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId }));
|
|
23
|
+
const buttonTabs = screen.getByTestId(qaId);
|
|
24
|
+
expect(buttonTabs).toBeInTheDocument();
|
|
25
|
+
expect(buttonTabs).toBeVisible();
|
|
26
|
+
expect(buttonTabs).not.toBeDisabled();
|
|
27
|
+
});
|
|
28
|
+
test('has active tab', async () => {
|
|
29
|
+
const activeTabId = 1;
|
|
30
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, activeTab: String(activeTabId) }));
|
|
31
|
+
const buttons = screen.getAllByRole('button');
|
|
32
|
+
buttons.forEach((button, index) => {
|
|
33
|
+
if (index === activeTabId) {
|
|
34
|
+
expect(button).toHaveClass('pc-button-tabs__item_active');
|
|
35
|
+
}
|
|
36
|
+
expect(button).toHaveClass('pc-button-block_theme_normal');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
test('add className', () => {
|
|
40
|
+
const className = 'my-class';
|
|
41
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, className: className }));
|
|
42
|
+
const buttonTabs = screen.getByTestId(qaId);
|
|
43
|
+
expect(buttonTabs).toHaveClass(className);
|
|
44
|
+
});
|
|
45
|
+
test('call onSelectTab', async () => {
|
|
46
|
+
const user = userEvent.setup();
|
|
47
|
+
const handleOnClick = jest.fn();
|
|
48
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, onSelectTab: handleOnClick }));
|
|
49
|
+
const buttons = screen.getAllByRole('button');
|
|
50
|
+
buttons.forEach(async (button, i) => {
|
|
51
|
+
await user.click(button);
|
|
52
|
+
expect(handleOnClick).toHaveBeenCalledTimes(i + 1);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ImageProps } from '../Image/Image';
|
|
3
|
-
import './
|
|
3
|
+
import './FullscreenImage.css';
|
|
4
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;
|
|
@@ -4,20 +4,20 @@ 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 './
|
|
7
|
+
import './FullscreenImage.css';
|
|
8
8
|
const b = block('FullScreenImage');
|
|
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
23
|
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
|
|
@@ -27,4 +27,4 @@ const FullScreenImage = (props) => {
|
|
|
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,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MediaAllProps } from '../Media/Media';
|
|
3
|
+
import './FullscreenMedia.css';
|
|
4
|
+
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'fullscreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
5
|
+
export interface FullScreenMediaProps {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use showFullscreenIcon
|
|
8
|
+
*/
|
|
9
|
+
showFullScreenIcon?: boolean;
|
|
10
|
+
showFullscreenIcon?: boolean;
|
|
11
|
+
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare const FullscreenMedia: ({ children, showFullScreenIcon, showFullscreenIcon, }: FullScreenMediaProps) => JSX.Element;
|
|
14
|
+
export default FullscreenMedia;
|
|
@@ -3,12 +3,12 @@ import { Icon, Modal } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
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, showFullscreenIcon = true, }) => {
|
|
12
12
|
const [isOpened, setIsOpened] = useState(false);
|
|
13
13
|
const isMobile = useContext(MobileContext);
|
|
14
14
|
const openModal = (e) => {
|
|
@@ -22,7 +22,7 @@ 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
|
-
showFullScreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
25
|
+
showFullScreenIcon && showFullscreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
26
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') },
|
|
@@ -35,4 +35,4 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
|
35
35
|
fullScreen: true,
|
|
36
36
|
}))))));
|
|
37
37
|
};
|
|
38
|
-
export default
|
|
38
|
+
export default FullscreenMedia;
|
|
@@ -5,7 +5,6 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
|
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
7
|
containerClassName?: string;
|
|
8
|
-
qa?: string;
|
|
9
8
|
}
|
|
10
9
|
declare const Image: (props: ImageProps) => JSX.Element | null;
|
|
11
10
|
export default Image;
|
|
@@ -9,7 +9,7 @@ const checkWebP = (src) => {
|
|
|
9
9
|
};
|
|
10
10
|
const Image = (props) => {
|
|
11
11
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
12
|
-
const { src: imageSrc, alt = i18n('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName,
|
|
12
|
+
const { src: imageSrc, alt = i18n('img-alt'), disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, } = props;
|
|
13
13
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
14
14
|
const src = imageSrc || desktop;
|
|
15
15
|
if (!src) {
|
|
@@ -19,7 +19,7 @@ const Image = (props) => {
|
|
|
19
19
|
disableCompress ||
|
|
20
20
|
!isCompressible(src) ||
|
|
21
21
|
imgLoadingError;
|
|
22
|
-
return (React.createElement("picture", { className: containerClassName
|
|
22
|
+
return (React.createElement("picture", { className: containerClassName },
|
|
23
23
|
mobile && (React.createElement(Fragment, null,
|
|
24
24
|
!disableWebp && (React.createElement("source", { srcSet: checkWebP(mobile), type: "image/webp", media: `(max-width: ${BREAKPOINTS.sm}px)` })),
|
|
25
25
|
React.createElement("source", { srcSet: mobile, media: `(max-width: ${BREAKPOINTS.sm}px)` }))),
|
|
@@ -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 fullscreenImage = (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 ? fullscreenImage(item) : imageOnly(item))));
|
|
51
|
+
};
|
|
48
52
|
if (Array.isArray(image)) {
|
|
49
53
|
return imageSlider(image);
|
|
50
54
|
}
|
|
55
|
+
if (fullscreen) {
|
|
56
|
+
return fullscreenImage(image);
|
|
57
|
+
}
|
|
51
58
|
return isBackground ? imageBackground(image) : imageOnly(image);
|
|
52
59
|
};
|
|
53
60
|
export default Image;
|
|
@@ -2,24 +2,44 @@ import React, { useMemo, useState } from 'react';
|
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import YoutubeBlock from '../VideoBlock/VideoBlock';
|
|
4
4
|
import DataLens from './DataLens/DataLens';
|
|
5
|
+
import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
|
|
5
6
|
import Image from './Image/Image';
|
|
6
7
|
import Video from './Video/Video';
|
|
7
8
|
import './Media.css';
|
|
8
9
|
const b = block('Media');
|
|
9
10
|
export const Media = (props) => {
|
|
10
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, analyticsEvents, } = props;
|
|
11
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, fullscreen, analyticsEvents, } = props;
|
|
11
12
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
12
13
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
14
|
const content = useMemo(() => {
|
|
14
15
|
let result = [];
|
|
15
16
|
if (image) {
|
|
16
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
17
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullScreen || fullscreen }));
|
|
17
18
|
}
|
|
18
19
|
if (video) {
|
|
19
|
-
|
|
20
|
+
const videoProps = {
|
|
21
|
+
key: 'video',
|
|
22
|
+
video,
|
|
23
|
+
videoClassName,
|
|
24
|
+
height,
|
|
25
|
+
metrika,
|
|
26
|
+
analyticsEvents,
|
|
27
|
+
playVideo,
|
|
28
|
+
previewImg,
|
|
29
|
+
playButton,
|
|
30
|
+
customBarControlsClassName,
|
|
31
|
+
hasVideoFallback,
|
|
32
|
+
setHasVideoFallback,
|
|
33
|
+
};
|
|
34
|
+
if (fullScreen || fullscreen) {
|
|
35
|
+
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result.push(React.createElement(Video, Object.assign({}, videoProps)));
|
|
39
|
+
}
|
|
20
40
|
}
|
|
21
41
|
if (youtube) {
|
|
22
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height,
|
|
42
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullScreen || fullscreen }));
|
|
23
43
|
}
|
|
24
44
|
if (dataLens) {
|
|
25
45
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -44,6 +64,7 @@ export const Media = (props) => {
|
|
|
44
64
|
customBarControlsClassName,
|
|
45
65
|
youtubeClassName,
|
|
46
66
|
fullScreen,
|
|
67
|
+
fullscreen,
|
|
47
68
|
]);
|
|
48
69
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
49
70
|
};
|
|
@@ -11,6 +11,6 @@ interface InnerVideoProps {
|
|
|
11
11
|
setHasVideoFallback: React.Dispatch<boolean>;
|
|
12
12
|
hasVideoFallback: boolean;
|
|
13
13
|
}
|
|
14
|
-
type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
14
|
+
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
15
15
|
declare const Video: (props: VideoAllProps) => JSX.Element | null;
|
|
16
16
|
export default Video;
|
|
@@ -14,7 +14,11 @@ export interface VideoBlockProps {
|
|
|
14
14
|
previewImg?: string;
|
|
15
15
|
playButton?: React.ReactNode;
|
|
16
16
|
height?: number;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use fullscreen
|
|
19
|
+
*/
|
|
17
20
|
fullScreen?: boolean;
|
|
21
|
+
fullscreen?: boolean;
|
|
18
22
|
}
|
|
19
23
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
20
24
|
export default VideoBlock;
|
|
@@ -35,7 +35,7 @@ export function getHeight(width) {
|
|
|
35
35
|
return (width / 16) * 9;
|
|
36
36
|
}
|
|
37
37
|
const VideoBlock = (props) => {
|
|
38
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
|
|
38
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, } = props;
|
|
39
39
|
const src = getVideoSrc(stream, record);
|
|
40
40
|
const ref = useRef(null);
|
|
41
41
|
const iframeRef = useRef();
|
|
@@ -78,14 +78,14 @@ const VideoBlock = (props) => {
|
|
|
78
78
|
ref.current.appendChild(iframe);
|
|
79
79
|
iframeRef.current = iframe;
|
|
80
80
|
}
|
|
81
|
-
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
|
|
81
|
+
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen, fullscreen]);
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
setHidePreview(false);
|
|
84
84
|
}, [src, setHidePreview]);
|
|
85
85
|
if (norender) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
88
|
+
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
89
89
|
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
90
90
|
playButton || (React.createElement("button", { className: b('button') },
|
|
91
91
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
@@ -35,6 +35,6 @@ export { default as Author } from './Author/Author';
|
|
|
35
35
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
36
36
|
export { default as HTML } from './HTML/HTML';
|
|
37
37
|
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
38
|
-
export { default as FullScreenMedia } from './FullscreenMedia/
|
|
38
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullscreenMedia';
|
|
39
39
|
export type { RouterLinkProps } from './RouterLink/RouterLink';
|
|
40
40
|
export type { ImageBaseProps } from './ImageBase/ImageBase';
|
|
@@ -35,4 +35,4 @@ export { default as Author } from './Author/Author';
|
|
|
35
35
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
36
36
|
export { default as HTML } from './HTML/HTML';
|
|
37
37
|
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
38
|
-
export { default as FullScreenMedia } from './FullscreenMedia/
|
|
38
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullscreenMedia';
|
|
@@ -36,7 +36,7 @@ export declare const subBlockMap: {
|
|
|
36
36
|
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
37
37
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
38
38
|
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
39
|
-
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
39
|
+
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, fullscreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated Use LayoutItem
|
|
42
42
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Block, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
|
|
3
3
|
import './Loadable.css';
|
|
4
4
|
export interface LoadableState {
|
|
5
5
|
loading: boolean;
|
|
@@ -9,7 +9,7 @@ export interface LoadableState {
|
|
|
9
9
|
export interface LoadableComponentsProps extends Omit<PropsWithChildren<LoadableProps>, 'source'> {
|
|
10
10
|
Component: CustomItem;
|
|
11
11
|
ChildComponent: CustomItem;
|
|
12
|
-
block:
|
|
12
|
+
block: Block;
|
|
13
13
|
blockKey: string;
|
|
14
14
|
fetch: FetchLoadableData;
|
|
15
15
|
}
|