@gravity-ui/page-constructor 4.54.0 → 4.56.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/build/cjs/blocks/Tabs/Tabs.css +8 -1
- package/build/cjs/blocks/Tabs/Tabs.js +3 -2
- package/build/cjs/blocks/Tabs/schema.d.ts +4 -0
- package/build/cjs/blocks/Tabs/schema.js +4 -1
- package/build/cjs/components/Buttons/Buttons.css +11 -0
- package/build/cjs/components/Buttons/Buttons.d.ts +12 -0
- package/build/cjs/components/Buttons/Buttons.js +18 -0
- package/build/cjs/components/CardBase/CardBase.d.ts +2 -3
- package/build/cjs/components/CardBase/CardBase.js +5 -6
- package/build/cjs/components/Foldable/Foldable.d.ts +3 -3
- package/build/cjs/components/Foldable/Foldable.js +4 -3
- package/build/cjs/components/Links/Links.css +14 -0
- package/build/cjs/components/Links/Links.d.ts +12 -0
- package/build/cjs/components/Links/Links.js +18 -0
- package/build/cjs/components/index.d.ts +2 -1
- package/build/cjs/components/index.js +4 -2
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +4 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/cjs/schema/constants.d.ts +12 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +15 -3
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +3 -0
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +17 -8
- package/build/cjs/sub-blocks/BasicCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/BasicCard/schema.js +3 -0
- package/build/cjs/sub-blocks/Content/Content.css +0 -22
- package/build/cjs/sub-blocks/Content/Content.js +10 -21
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +6 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +16 -4
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +3 -0
- package/build/cjs/sub-blocks/PriceCard/PriceCard.css +2 -5
- package/build/cjs/sub-blocks/PriceCard/PriceCard.js +4 -4
- package/build/cjs/sub-blocks/PriceCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/PriceCard/schema.js +3 -0
- package/build/cjs/sub-blocks/renderCardFooterControlsContainer/CardFooterControlsContainer.css +3 -0
- package/build/cjs/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.d.ts +3 -0
- package/build/cjs/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.js +9 -0
- package/build/cjs/utils/renderContentControls/ContentControls.css +6 -0
- package/build/cjs/utils/renderContentControls/renderContentControls.d.ts +11 -0
- package/build/cjs/utils/renderContentControls/renderContentControls.js +16 -0
- package/build/esm/blocks/Tabs/Tabs.css +8 -1
- package/build/esm/blocks/Tabs/Tabs.js +3 -2
- package/build/esm/blocks/Tabs/schema.d.ts +4 -0
- package/build/esm/blocks/Tabs/schema.js +4 -1
- package/build/esm/components/Buttons/Buttons.css +11 -0
- package/build/esm/components/Buttons/Buttons.d.ts +13 -0
- package/build/esm/components/Buttons/Buttons.js +16 -0
- package/build/esm/components/CardBase/CardBase.d.ts +2 -3
- package/build/esm/components/CardBase/CardBase.js +6 -7
- package/build/esm/components/Foldable/Foldable.d.ts +3 -3
- package/build/esm/components/Foldable/Foldable.js +5 -4
- package/build/esm/components/Links/Links.css +14 -0
- package/build/esm/components/Links/Links.d.ts +13 -0
- package/build/esm/components/Links/Links.js +16 -0
- package/build/esm/components/index.d.ts +2 -1
- package/build/esm/components/index.js +2 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/common.d.ts +4 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/esm/schema/constants.d.ts +12 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +15 -3
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +3 -0
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +14 -5
- package/build/esm/sub-blocks/BasicCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/BasicCard/schema.js +3 -0
- package/build/esm/sub-blocks/Content/Content.css +0 -22
- package/build/esm/sub-blocks/Content/Content.js +11 -22
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +6 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +16 -4
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +3 -0
- package/build/esm/sub-blocks/PriceCard/PriceCard.css +2 -5
- package/build/esm/sub-blocks/PriceCard/PriceCard.js +5 -5
- package/build/esm/sub-blocks/PriceCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/PriceCard/schema.js +3 -0
- package/build/esm/sub-blocks/renderCardFooterControlsContainer/CardFooterControlsContainer.css +3 -0
- package/build/esm/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.d.ts +3 -0
- package/build/esm/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.js +6 -0
- package/build/esm/utils/renderContentControls/ContentControls.css +6 -0
- package/build/esm/utils/renderContentControls/renderContentControls.d.ts +12 -0
- package/build/esm/utils/renderContentControls/renderContentControls.js +14 -0
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -1
- package/server/models/constructor-items/common.d.ts +4 -0
- package/server/models/constructor-items/sub-blocks.d.ts +4 -4
- package/widget/index.js +1 -1
- package/build/cjs/components/Link/Links.d.ts +0 -6
- package/build/cjs/components/Link/Links.js +0 -13
- package/build/esm/components/Link/Links.d.ts +0 -6
- package/build/esm/components/Link/Links.js +0 -10
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
|
-
import CardBase from '../../components
|
|
5
|
-
import IconWrapper from '../../components/IconWrapper/IconWrapper';
|
|
4
|
+
import { CardBase, IconWrapper } from '../../components';
|
|
6
5
|
import { IconPosition } from '../../models/constructor-items/sub-blocks';
|
|
7
6
|
import { block } from '../../utils';
|
|
7
|
+
import renderContentControls from '../../utils/renderContentControls/renderContentControls';
|
|
8
8
|
import Content from '../Content/Content';
|
|
9
|
+
import renderCardFooterControlsContainer from '../renderCardFooterControlsContainer/renderCardFooterControlsContainer';
|
|
9
10
|
import './BasicCard.css';
|
|
10
11
|
const b = block('basic-card');
|
|
11
12
|
const BasicCard = (props) => {
|
|
12
|
-
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = IconPosition.Top } = props, cardParams = __rest(props, ["title", "text", "icon", "additionalInfo", "links", "list", "buttons", "iconPosition"]);
|
|
13
|
+
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = IconPosition.Top, controlPosition = 'content' } = props, cardParams = __rest(props, ["title", "text", "icon", "additionalInfo", "links", "list", "buttons", "iconPosition", "controlPosition"]);
|
|
13
14
|
const titleId = useUniqId();
|
|
14
15
|
const descriptionId = useUniqId();
|
|
16
|
+
const areControlsInFooter = controlPosition === 'footer';
|
|
17
|
+
const footerControls = useMemo(() => renderContentControls({
|
|
18
|
+
links: areControlsInFooter ? links : undefined,
|
|
19
|
+
buttons: areControlsInFooter ? buttons : undefined,
|
|
20
|
+
size: 's',
|
|
21
|
+
titleId,
|
|
22
|
+
}, renderCardFooterControlsContainer), [areControlsInFooter, links, buttons, titleId]);
|
|
15
23
|
return (React.createElement(CardBase, Object.assign({ className: b() }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
16
24
|
React.createElement(CardBase.Content, null,
|
|
17
25
|
React.createElement(IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined },
|
|
18
|
-
React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size: "s", colSizes: { all: 12, md: 12 } })))
|
|
26
|
+
React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: areControlsInFooter ? undefined : links, list: list, buttons: areControlsInFooter ? undefined : buttons, size: "s", colSizes: { all: 12, md: 12 } }))),
|
|
27
|
+
footerControls));
|
|
19
28
|
};
|
|
20
29
|
export default BasicCard;
|
|
@@ -27,16 +27,6 @@ unpredictable css rules order in build */
|
|
|
27
27
|
color: var(--g-color-text-primary);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.pc-content__buttons {
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-wrap: wrap;
|
|
33
|
-
column-gap: 12px;
|
|
34
|
-
}
|
|
35
|
-
.pc-content__links {
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
align-items: baseline;
|
|
39
|
-
}
|
|
40
30
|
.pc-content__link {
|
|
41
31
|
display: block;
|
|
42
32
|
}
|
|
@@ -67,12 +57,6 @@ unpredictable css rules order in build */
|
|
|
67
57
|
.pc-content_size_s .pc-content__text_without-title {
|
|
68
58
|
margin-top: 0;
|
|
69
59
|
}
|
|
70
|
-
.pc-content_size_s .pc-content__links,
|
|
71
|
-
.pc-content_size_s .pc-content__link,
|
|
72
|
-
.pc-content_size_s .pc-content__buttons,
|
|
73
|
-
.pc-content_size_s .pc-content__button {
|
|
74
|
-
margin-top: 8px;
|
|
75
|
-
}
|
|
76
60
|
.pc-content_size_s .pc-content__list {
|
|
77
61
|
margin-top: 16px;
|
|
78
62
|
}
|
|
@@ -88,12 +72,6 @@ unpredictable css rules order in build */
|
|
|
88
72
|
font-size: var(--g-text-body-3-font-size);
|
|
89
73
|
line-height: var(--g-text-body-3-line-height);
|
|
90
74
|
}
|
|
91
|
-
.pc-content_size_l .pc-content__links,
|
|
92
|
-
.pc-content_size_l .pc-content__link,
|
|
93
|
-
.pc-content_size_l .pc-content__buttons,
|
|
94
|
-
.pc-content_size_l .pc-content__button {
|
|
95
|
-
margin-top: 12px;
|
|
96
|
-
}
|
|
97
75
|
.pc-content_size_l .pc-content__list {
|
|
98
76
|
margin-top: 24px;
|
|
99
77
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
3
|
+
import { ContentList, Title, YFMWrapper } from '../../components';
|
|
4
4
|
import { Col } from '../../grid';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
6
|
import { getQaAttrubutes } from '../../utils/blocks';
|
|
7
|
+
import renderContentControls from '../../utils/renderContentControls/renderContentControls';
|
|
7
8
|
import './Content.css';
|
|
8
9
|
const b = block('content');
|
|
9
10
|
function getTextSize(size) {
|
|
@@ -15,24 +16,6 @@ function getTextSize(size) {
|
|
|
15
16
|
return 'm';
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
|
-
function getLinkSize(size) {
|
|
19
|
-
switch (size) {
|
|
20
|
-
case 's':
|
|
21
|
-
return 'm';
|
|
22
|
-
case 'l':
|
|
23
|
-
default:
|
|
24
|
-
return 'l';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getButtonSize(size) {
|
|
28
|
-
switch (size) {
|
|
29
|
-
case 's':
|
|
30
|
-
return 'm';
|
|
31
|
-
case 'l':
|
|
32
|
-
default:
|
|
33
|
-
return 'xl';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
19
|
const Content = (props) => {
|
|
37
20
|
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
|
|
38
21
|
const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);
|
|
@@ -42,6 +25,13 @@ const Content = (props) => {
|
|
|
42
25
|
const hasTitle = Boolean(title);
|
|
43
26
|
const defaultTitleId = useUniqId();
|
|
44
27
|
const titleId = titleIdFromProps || defaultTitleId;
|
|
28
|
+
const controls = useMemo(() => renderContentControls({
|
|
29
|
+
size,
|
|
30
|
+
links,
|
|
31
|
+
buttons,
|
|
32
|
+
titleId,
|
|
33
|
+
qa: qaAttributes,
|
|
34
|
+
}), [size, links, buttons, titleId, qaAttributes]);
|
|
45
35
|
return (React.createElement(Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
46
36
|
title && (React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })),
|
|
47
37
|
text && (React.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
@@ -54,7 +44,6 @@ const Content = (props) => {
|
|
|
54
44
|
'constructor-notice': true,
|
|
55
45
|
[`constructor-size-${size}`]: true,
|
|
56
46
|
} }))),
|
|
57
|
-
|
|
58
|
-
buttons && (React.createElement("div", { className: b('buttons'), "data-qa": qaAttributes.buttons }, buttons.map((item) => (React.createElement(Button, Object.assign({ className: b('button') }, item, { key: item.url, size: getButtonSize(size), qa: qaAttributes.button, extraProps: Object.assign({ 'aria-describedby': item.urlTitle ? undefined : titleId }, item.extraProps) }))))))));
|
|
47
|
+
controls));
|
|
59
48
|
};
|
|
60
49
|
export default Content;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
+
.pc-layout-item {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
3
8
|
.pc-layout-item__media {
|
|
4
9
|
width: 100%;
|
|
5
10
|
display: block;
|
|
@@ -12,6 +17,7 @@ unpredictable css rules order in build */
|
|
|
12
17
|
margin: 16px 0 -8px 0;
|
|
13
18
|
}
|
|
14
19
|
.pc-layout-item__content {
|
|
20
|
+
flex: auto;
|
|
15
21
|
margin: 16px 16px 0 0;
|
|
16
22
|
}
|
|
17
23
|
.pc-layout-item__content_no-media {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LayoutItemProps } from '../../models';
|
|
2
2
|
import './LayoutItem.css';
|
|
3
|
-
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, }: LayoutItemProps) => JSX.Element;
|
|
3
|
+
declare const LayoutItem: ({ content: { links, buttons, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: LayoutItemProps) => JSX.Element;
|
|
4
4
|
export default LayoutItem;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { useUniqId } from '@gravity-ui/uikit';
|
|
3
4
|
import { FullscreenMedia, IconWrapper, Media, MetaInfo } from '../../components';
|
|
4
5
|
import { block } from '../../utils';
|
|
6
|
+
import renderContentControls from '../../utils/renderContentControls/renderContentControls';
|
|
5
7
|
import Content from '../Content/Content';
|
|
6
8
|
import { getLayoutItemLinks, hasFullscreen, showFullscreenIcon } from './utils';
|
|
7
9
|
import './LayoutItem.css';
|
|
8
10
|
const b = block('layout-item');
|
|
9
11
|
const LayoutItem = (_a) => {
|
|
10
|
-
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents } = _a;
|
|
11
|
-
const
|
|
12
|
+
var _b = _a.content, { links, buttons } = _b, content = __rest(_b, ["links", "buttons"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
|
|
13
|
+
const normalizedLinks = useMemo(() => getLayoutItemLinks(links), [links]);
|
|
14
|
+
const areControlsInFooter = controlPosition === 'footer';
|
|
15
|
+
const contentProps = Object.assign(Object.assign(Object.assign({}, content), (areControlsInFooter ? {} : { links: normalizedLinks, buttons })), { size: 's', colSizes: { all: 12, md: 12 } });
|
|
16
|
+
const titleId = useUniqId();
|
|
17
|
+
const footerControls = useMemo(() => renderContentControls({
|
|
18
|
+
links: areControlsInFooter ? links : undefined,
|
|
19
|
+
buttons: areControlsInFooter ? buttons : undefined,
|
|
20
|
+
size: 's',
|
|
21
|
+
titleId,
|
|
22
|
+
}), [areControlsInFooter, links, buttons, titleId]);
|
|
12
23
|
const renderMedia = () => {
|
|
13
24
|
if (!media) {
|
|
14
25
|
return null;
|
|
@@ -23,6 +34,7 @@ const LayoutItem = (_a) => {
|
|
|
23
34
|
metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
24
35
|
React.createElement("div", { className: b('content', { 'no-media': !media }) },
|
|
25
36
|
React.createElement(IconWrapper, { icon: icon },
|
|
26
|
-
React.createElement(Content, Object.assign({}, contentProps))))
|
|
37
|
+
React.createElement(Content, Object.assign({}, contentProps, { titleId: titleId })))),
|
|
38
|
+
footerControls));
|
|
27
39
|
};
|
|
28
40
|
export default LayoutItem;
|
|
@@ -86,11 +86,8 @@ unpredictable css rules order in build */
|
|
|
86
86
|
.pc-price-card__links, .pc-price-card__buttons {
|
|
87
87
|
margin-top: 24px;
|
|
88
88
|
}
|
|
89
|
-
.pc-price-
|
|
90
|
-
margin-
|
|
91
|
-
}
|
|
92
|
-
.pc-price-card__link {
|
|
93
|
-
margin-top: 0;
|
|
89
|
+
.pc-price-card__footer {
|
|
90
|
+
margin-top: 0px;
|
|
94
91
|
}
|
|
95
92
|
@media (max-width: 769px) {
|
|
96
93
|
.pc-price-card__title, .pc-price-card__price {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Check from '@gravity-ui/icons/Check';
|
|
3
|
-
import { BackgroundImage,
|
|
3
|
+
import { BackgroundImage, Buttons, CardBase, ContentList, HTML, Links } from '../../components';
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import './PriceCard.css';
|
|
6
6
|
const b = block('price-card');
|
|
7
7
|
const PriceCard = (props) => {
|
|
8
8
|
const { border, title, price, pricePeriod, priceDetails, theme, description, list, buttons, links, backgroundColor, } = props;
|
|
9
9
|
return (React.createElement(CardBase, { className: b({ theme }), border: border },
|
|
10
|
-
React.createElement(CardBase.Content,
|
|
10
|
+
React.createElement(CardBase.Content, { key: "content" },
|
|
11
11
|
React.createElement(BackgroundImage, { className: b('background'), style: { backgroundColor } }),
|
|
12
12
|
React.createElement("div", { className: b('content', { theme }) },
|
|
13
13
|
React.createElement("div", { className: b('info') },
|
|
14
|
-
React.createElement(
|
|
14
|
+
React.createElement(HTML, { className: b('title') }, title),
|
|
15
15
|
React.createElement("div", { className: b('price') },
|
|
16
16
|
React.createElement("div", null,
|
|
17
17
|
React.createElement("span", { className: b('price-value') }, price),
|
|
@@ -25,7 +25,7 @@ const PriceCard = (props) => {
|
|
|
25
25
|
icon: Check,
|
|
26
26
|
text: item,
|
|
27
27
|
})), size: "l" }))) : null),
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
React.createElement(Buttons, { className: b('buttons'), buttons: buttons, size: "s" }),
|
|
29
|
+
React.createElement(Links, { className: b('links'), links: links, size: "s" })))));
|
|
30
30
|
};
|
|
31
31
|
export default PriceCard;
|
package/build/esm/sub-blocks/renderCardFooterControlsContainer/renderCardFooterControlsContainer.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CardBase } from '../../components';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
const b = block('card-footer-controls-containe');
|
|
5
|
+
const renderCardFooterControlsContainer = (children) => (React.createElement(CardBase.Footer, { className: b() }, children));
|
|
6
|
+
export default renderCardFooterControlsContainer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps, ContentSize, LinkProps } from '../../models';
|
|
3
|
+
import './ContentControls.css';
|
|
4
|
+
type ContentControlsArgs = {
|
|
5
|
+
links?: LinkProps[];
|
|
6
|
+
buttons?: ButtonProps[];
|
|
7
|
+
titleId?: string;
|
|
8
|
+
size?: ContentSize;
|
|
9
|
+
qa?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
declare const renderContentControls: ({ links, buttons, titleId, size, qa }: ContentControlsArgs, renderContainer?: (children: React.ReactElement) => React.ReactElement) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
12
|
+
export default renderContentControls;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { Buttons, Links } from '../../components';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import './ContentControls.css';
|
|
5
|
+
const b = block('content-controls');
|
|
6
|
+
const renderContentControls = ({ links, buttons, titleId, size = 's', qa = {} }, renderContainer = (children) => children) => {
|
|
7
|
+
const { links: linksQa, link: linkQa, buttons: buttonsQa, button: buttonQa } = qa;
|
|
8
|
+
return links || buttons
|
|
9
|
+
? renderContainer(React.createElement(Fragment, null,
|
|
10
|
+
React.createElement(Links, { className: b('links', { size }), size: size, links: links, titleId: titleId, qa: linksQa, linkQa: linkQa }),
|
|
11
|
+
React.createElement(Buttons, { className: b('buttons', { size }), size: size, buttons: buttons, titleId: titleId, qa: buttonsQa, buttonQa: buttonQa })))
|
|
12
|
+
: null;
|
|
13
|
+
};
|
|
14
|
+
export default renderContentControls;
|
package/package.json
CHANGED
|
@@ -209,7 +209,7 @@ export interface TableBlockProps {
|
|
|
209
209
|
title: string;
|
|
210
210
|
table: TableProps;
|
|
211
211
|
}
|
|
212
|
-
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'
|
|
212
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>, WithBorder {
|
|
213
213
|
tabName: string;
|
|
214
214
|
/**
|
|
215
215
|
* @deprecated Use array links from ContentBlockProps instead
|
|
@@ -297,9 +297,13 @@ export interface TitleItemBaseProps {
|
|
|
297
297
|
export type MediaView = 'fit' | 'full';
|
|
298
298
|
export type MediaBorder = 'shadow' | 'line' | 'none';
|
|
299
299
|
export type CardBorder = MediaBorder;
|
|
300
|
+
export type ControlPosition = 'content' | 'footer';
|
|
300
301
|
export interface CardBaseProps {
|
|
301
302
|
border?: CardBorder;
|
|
302
303
|
}
|
|
304
|
+
export type CardLayoutProps = {
|
|
305
|
+
controlPosition?: ControlPosition;
|
|
306
|
+
};
|
|
303
307
|
export interface PriceDescriptionProps {
|
|
304
308
|
title: string;
|
|
305
309
|
detailedTitle?: string;
|
|
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
|
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
4
|
import { AnalyticsEventsBase, PixelEvent } from '../common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageCardMargins, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
6
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, CardLayoutProps, ContentTheme, DividerSize, ImageCardMargins, ImageObjectProps, ImageProps, LinkProps, MediaProps, MediaView, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
8
8
|
Divider = "divider",
|
|
9
9
|
Quote = "quote",
|
|
@@ -97,14 +97,14 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
97
97
|
quoteType?: QuoteType;
|
|
98
98
|
button?: ButtonProps;
|
|
99
99
|
}
|
|
100
|
-
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
100
|
+
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
101
101
|
url?: string;
|
|
102
102
|
urlTitle?: string;
|
|
103
103
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
104
104
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
105
105
|
backgroundColor?: string;
|
|
106
106
|
}
|
|
107
|
-
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
107
|
+
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
108
108
|
url: string;
|
|
109
109
|
urlTitle?: string;
|
|
110
110
|
icon?: ImageProps;
|
|
@@ -134,7 +134,7 @@ export interface PriceCardProps extends CardBaseProps, Pick<ContentBlockProps, '
|
|
|
134
134
|
backgroundColor?: string;
|
|
135
135
|
list?: string[];
|
|
136
136
|
}
|
|
137
|
-
export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
|
|
137
|
+
export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, AnalyticsEventsBase {
|
|
138
138
|
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
|
|
139
139
|
media?: MediaProps;
|
|
140
140
|
metaInfo?: string[];
|