@redneckz/wildless-cms-uni-blocks 0.3.54 → 0.3.56
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/bundle/bundle.umd.js +12 -17
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/ComparisonTable/HeaderCell.js +1 -1
- package/dist/components/ComparisonTable/HeaderCell.js.map +1 -1
- package/dist/components/ContentPage/ContentPage.js +3 -5
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/ContentPage/ContentPageHead.js +1 -1
- package/dist/components/ContentPage/ContentPageHead.js.map +1 -1
- package/dist/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/dist/components/ContentPage/CustomContentPage.js +33 -0
- package/dist/components/ContentPage/CustomContentPage.js.map +1 -0
- package/dist/components/Gallery/Gallery.mobile.js +1 -1
- package/dist/components/Gallery/Gallery.mobile.js.map +1 -1
- package/dist/components/OtherProducts/OtherProducts.js +2 -2
- package/dist/components/OtherProducts/OtherProducts.js.map +1 -1
- package/dist/components/OtherProducts/OtherProductsItem.d.ts +2 -0
- package/dist/components/OtherProducts/OtherProductsItem.js +2 -2
- package/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/dist/components/ProductTile/ProductTile.js +1 -1
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/TariffsTable/TariffsTableCell.js +1 -1
- package/dist/components/TariffsTable/TariffsTableCell.js.map +1 -1
- package/dist/components/TariffsTable/TariffsTableTileCell.js +1 -1
- package/dist/components/TariffsTable/TariffsTableTileCell.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/ui-kit/Button/Button.js +2 -6
- package/dist/ui-kit/Button/Button.js.map +1 -1
- package/dist/ui-kit/List/ListItem.js +1 -1
- package/dist/ui-kit/List/ListItem.js.map +1 -1
- package/dist/utils/style2className.d.ts +1 -0
- package/dist/utils/style2className.js +5 -0
- package/dist/utils/style2className.js.map +1 -0
- package/lib/components/ComparisonTable/HeaderCell.js +1 -1
- package/lib/components/ComparisonTable/HeaderCell.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +1 -3
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/ContentPage/ContentPageHead.js +1 -1
- package/lib/components/ContentPage/ContentPageHead.js.map +1 -1
- package/lib/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/lib/components/ContentPage/CustomContentPage.js +31 -0
- package/lib/components/ContentPage/CustomContentPage.js.map +1 -0
- package/lib/components/Gallery/Gallery.mobile.js +1 -1
- package/lib/components/Gallery/Gallery.mobile.js.map +1 -1
- package/lib/components/OtherProducts/OtherProducts.js +2 -2
- package/lib/components/OtherProducts/OtherProducts.js.map +1 -1
- package/lib/components/OtherProducts/OtherProductsItem.d.ts +2 -0
- package/lib/components/OtherProducts/OtherProductsItem.js +2 -2
- package/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/lib/components/ProductTile/ProductTile.js +1 -1
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/TariffsTable/TariffsTableCell.js +1 -1
- package/lib/components/TariffsTable/TariffsTableCell.js.map +1 -1
- package/lib/components/TariffsTable/TariffsTableTileCell.js +1 -1
- package/lib/components/TariffsTable/TariffsTableTileCell.js.map +1 -1
- package/lib/types.d.ts +5 -0
- package/lib/ui-kit/Button/Button.js +2 -6
- package/lib/ui-kit/Button/Button.js.map +1 -1
- package/lib/ui-kit/List/ListItem.js +1 -1
- package/lib/ui-kit/List/ListItem.js.map +1 -1
- package/lib/utils/style2className.d.ts +1 -0
- package/lib/utils/style2className.js +2 -0
- package/lib/utils/style2className.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +5 -6
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +3 -5
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/ContentPage/ContentPageHead.js +1 -1
- package/mobile/dist/components/ContentPage/ContentPageHead.js.map +1 -1
- package/mobile/dist/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/mobile/dist/components/ContentPage/CustomContentPage.js +33 -0
- package/mobile/dist/components/ContentPage/CustomContentPage.js.map +1 -0
- package/mobile/dist/components/Gallery/Gallery.js +1 -1
- package/mobile/dist/components/Gallery/Gallery.js.map +1 -1
- package/mobile/dist/components/OtherProducts/OtherProducts.js +2 -2
- package/mobile/dist/components/OtherProducts/OtherProducts.js.map +1 -1
- package/mobile/dist/components/OtherProducts/OtherProductsItem.d.ts +2 -0
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js +2 -2
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTile.js +1 -1
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTableCell.js +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTableCell.js.map +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTableTileCell.js +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTableTileCell.js.map +1 -1
- package/mobile/dist/types.d.ts +5 -0
- package/mobile/dist/ui-kit/List/ListItem.js +1 -1
- package/mobile/dist/ui-kit/List/ListItem.js.map +1 -1
- package/mobile/dist/utils/style2className.d.ts +1 -0
- package/mobile/dist/utils/style2className.js +5 -0
- package/mobile/dist/utils/style2className.js.map +1 -0
- package/mobile/lib/components/ContentPage/ContentPage.js +1 -3
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/ContentPage/ContentPageHead.js +1 -1
- package/mobile/lib/components/ContentPage/ContentPageHead.js.map +1 -1
- package/mobile/lib/components/ContentPage/CustomContentPage.d.ts +30 -0
- package/mobile/lib/components/ContentPage/CustomContentPage.js +31 -0
- package/mobile/lib/components/ContentPage/CustomContentPage.js.map +1 -0
- package/mobile/lib/components/Gallery/Gallery.js +1 -1
- package/mobile/lib/components/Gallery/Gallery.js.map +1 -1
- package/mobile/lib/components/OtherProducts/OtherProducts.js +2 -2
- package/mobile/lib/components/OtherProducts/OtherProducts.js.map +1 -1
- package/mobile/lib/components/OtherProducts/OtherProductsItem.d.ts +2 -0
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js +2 -2
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTile.js +1 -1
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTableCell.js +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTableCell.js.map +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTableTileCell.js +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTableTileCell.js.map +1 -1
- package/mobile/lib/types.d.ts +5 -0
- package/mobile/lib/ui-kit/List/ListItem.js +1 -1
- package/mobile/lib/ui-kit/List/ListItem.js.map +1 -1
- package/mobile/lib/utils/style2className.d.ts +1 -0
- package/mobile/lib/utils/style2className.js +2 -0
- package/mobile/lib/utils/style2className.js.map +1 -0
- package/mobile/src/components/ContentPage/ContentPage.tsx +1 -4
- package/mobile/src/components/ContentPage/ContentPageHead.tsx +5 -5
- package/mobile/src/components/ContentPage/CustomContentPage.tsx +82 -0
- package/mobile/src/components/Gallery/Gallery.tsx +1 -1
- package/mobile/src/components/Headline/Headline.example.json +3 -1
- package/mobile/src/components/OtherProducts/OtherProducts.tsx +8 -6
- package/mobile/src/components/OtherProducts/OtherProductsItem.tsx +6 -2
- package/mobile/src/components/ProductBlock/ProductBlock.example.json +9 -2
- package/mobile/src/components/ProductTile/ProductTile.example.json +2 -1
- package/mobile/src/components/ProductTile/ProductTile.tsx +3 -1
- package/mobile/src/components/PromoTile/PromoTile.example.json +2 -1
- package/mobile/src/components/TariffsTable/TariffsTableCell.tsx +1 -1
- package/mobile/src/components/TariffsTable/TariffsTableTileCell.tsx +1 -1
- package/mobile/src/components/Tile/Tile.example.json +9 -2
- package/mobile/src/types.ts +7 -1
- package/mobile/src/ui-kit/List/ListItem.tsx +1 -1
- package/mobile/src/utils/style2className.ts +2 -0
- package/package.json +1 -1
- package/src/components/ComparisonTable/HeaderCell.tsx +3 -1
- package/src/components/ContentPage/ContentPage.tsx +1 -4
- package/src/components/ContentPage/ContentPageHead.tsx +5 -5
- package/src/components/ContentPage/CustomContentPage.tsx +82 -0
- package/src/components/Gallery/Gallery.mobile.tsx +1 -1
- package/src/components/Headline/Headline.example.json +3 -1
- package/src/components/OtherProducts/OtherProducts.tsx +8 -6
- package/src/components/OtherProducts/OtherProductsItem.tsx +6 -2
- package/src/components/ProductBlock/ProductBlock.example.json +9 -2
- package/src/components/ProductTile/ProductTile.example.json +2 -1
- package/src/components/ProductTile/ProductTile.tsx +3 -1
- package/src/components/PromoTile/PromoTile.example.json +2 -1
- package/src/components/TariffsTable/TariffsTableCell.tsx +1 -1
- package/src/components/TariffsTable/TariffsTableTileCell.tsx +1 -1
- package/src/components/Tile/Tile.example.json +9 -2
- package/src/types.ts +7 -1
- package/src/ui-kit/Button/Button.tsx +0 -7
- package/src/ui-kit/List/ListItem.tsx +1 -1
- package/src/utils/style2className.ts +2 -0
|
@@ -6,16 +6,18 @@ import { OtherProductsItem } from './OtherProductsItem';
|
|
|
6
6
|
export interface OtherProductsProps extends OtherProductsContent, UniBlockProps {}
|
|
7
7
|
|
|
8
8
|
export const OtherProducts = JSX<OtherProductsProps>(
|
|
9
|
-
({ blockItems, colorPalette, context, className =
|
|
9
|
+
({ blockItems, colorPalette, context, className = '' }) => {
|
|
10
10
|
return (
|
|
11
|
-
<section
|
|
12
|
-
data-theme={colorPalette || null}
|
|
13
|
-
className={`font-sans bg-white text-primary-text ${className}`}
|
|
14
|
-
>
|
|
11
|
+
<section className={`font-sans bg-white text-primary-text ${className}`}>
|
|
15
12
|
{blockItems?.length ? (
|
|
16
13
|
<div className="list-none m-0 p-0">
|
|
17
14
|
{blockItems.map((item, i) => (
|
|
18
|
-
<OtherProductsItem
|
|
15
|
+
<OtherProductsItem
|
|
16
|
+
key={`BlockItem${i}`}
|
|
17
|
+
{...item}
|
|
18
|
+
dataTheme={colorPalette}
|
|
19
|
+
context={context}
|
|
20
|
+
/>
|
|
19
21
|
))}
|
|
20
22
|
</div>
|
|
21
23
|
) : null}
|
|
@@ -4,11 +4,14 @@ import { Icon } from '../../ui-kit/Icon/Icon';
|
|
|
4
4
|
import type { BlockItemCommonProps } from './OtherProductsContent';
|
|
5
5
|
import { OtherProductsItemInner } from './OtherProductsItemInner';
|
|
6
6
|
import { useActiveHandler } from './useActiveHandler';
|
|
7
|
+
import { ColorPalette } from '../../types';
|
|
7
8
|
|
|
8
|
-
export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
|
|
9
|
+
export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
|
|
10
|
+
dataTheme?: ColorPalette;
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
export const OtherProductsItem = JSX<BlockItemProps>(
|
|
11
|
-
({ label, isExpanded, blocks, columns, context }) => {
|
|
14
|
+
({ label, isExpanded, blocks, columns, dataTheme = null, context }) => {
|
|
12
15
|
const { hasContent, icon, handleToggle, isActive } = useActiveHandler({
|
|
13
16
|
context,
|
|
14
17
|
blocks,
|
|
@@ -27,6 +30,7 @@ export const OtherProductsItem = JSX<BlockItemProps>(
|
|
|
27
30
|
) : null}
|
|
28
31
|
<button
|
|
29
32
|
className="border-none bg-primary-main px-0 py-[26px] mb-[1px] w-full font-sans text-white text-base flex justify-center cursor-pointer"
|
|
33
|
+
data-theme={dataTheme}
|
|
30
34
|
onClick={handleToggle}
|
|
31
35
|
>
|
|
32
36
|
<span className="pr-3">{isActive ? 'Скрыть' : label}</span>
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"size": {
|
|
13
13
|
"width": 234,
|
|
14
14
|
"height": 234
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"alt": "",
|
|
17
|
+
"title": ""
|
|
16
18
|
},
|
|
17
19
|
"items": [
|
|
18
20
|
"Элемент списка 1",
|
|
@@ -23,7 +25,12 @@
|
|
|
23
25
|
"buttons": [
|
|
24
26
|
{
|
|
25
27
|
"text": "Кнопка",
|
|
26
|
-
"version": "secondary"
|
|
28
|
+
"version": "secondary",
|
|
29
|
+
"target": "",
|
|
30
|
+
"icon": {
|
|
31
|
+
"alt": "",
|
|
32
|
+
"title": ""
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
],
|
|
29
36
|
"version": "primary",
|
|
@@ -57,7 +57,9 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
57
57
|
}
|
|
58
58
|
image={image?.src && <Img className="mt-auto ml-7" image={image} />}
|
|
59
59
|
>
|
|
60
|
-
{description
|
|
60
|
+
{description ? (
|
|
61
|
+
<Description className="mt-4 max-w-[600px]" description={description} />
|
|
62
|
+
) : null}
|
|
61
63
|
<div className="flex mt-5 mb-1">
|
|
62
64
|
{benefits?.length ? (
|
|
63
65
|
<div className="mr-8">{benefits.map(renderBenefitLabel)}</div>
|
|
@@ -34,7 +34,7 @@ const renderCellInner = (
|
|
|
34
34
|
{label ? <div className="text-xl font-medium m-0">{label}</div> : null}
|
|
35
35
|
{description ? <div className="text-sm text-secondary-text">{description}</div> : null}
|
|
36
36
|
{list?.items?.length ? renderList(list) : null}
|
|
37
|
-
{image
|
|
37
|
+
{image ? <Img image={image} /> : null}
|
|
38
38
|
{buttons?.length ? renderButtons(buttons) : null}
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
@@ -33,7 +33,7 @@ const renderCellInner = (
|
|
|
33
33
|
<div className="text-m-sm text-secondary-text mt-[3px]">{description}</div>
|
|
34
34
|
) : null}
|
|
35
35
|
{list?.items?.length ? renderList(list) : null}
|
|
36
|
-
{image
|
|
36
|
+
{image ? <Img image={{ ...image, className: 'm-0' }} /> : null}
|
|
37
37
|
{buttons?.length ? renderButtons(buttons) : null}
|
|
38
38
|
</div>
|
|
39
39
|
);
|
|
@@ -7,13 +7,20 @@
|
|
|
7
7
|
"format": "webp",
|
|
8
8
|
"size": {
|
|
9
9
|
"width": 445
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"alt": "",
|
|
12
|
+
"title": ""
|
|
11
13
|
},
|
|
12
14
|
"items": ["Пункт 1", "Пункт 2", "Пункт 3"],
|
|
13
15
|
"buttons": [
|
|
14
16
|
{
|
|
15
17
|
"text": "Кнопка",
|
|
16
|
-
"version": "primary"
|
|
18
|
+
"version": "primary",
|
|
19
|
+
"target": "",
|
|
20
|
+
"icon": {
|
|
21
|
+
"alt": "",
|
|
22
|
+
"title": ""
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
],
|
|
19
26
|
"version": "primary"
|
package/mobile/src/types.ts
CHANGED
|
@@ -44,10 +44,16 @@ export interface ContentPageMeta {
|
|
|
44
44
|
jsonLd?: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export interface CustomPageTemplate {
|
|
48
|
+
content?: Record<string, any>;
|
|
49
|
+
type?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
export interface ContentPageDef extends ContentPageMeta {
|
|
48
53
|
style?: string[];
|
|
49
|
-
blocks?: BlockDef[];
|
|
54
|
+
blocks?: BlockDef[];
|
|
50
55
|
slots?: SlotsMap;
|
|
56
|
+
customPageTmpl?: CustomPageTemplate;
|
|
51
57
|
likeControl?: boolean;
|
|
52
58
|
colorPalette?: ColorPalette;
|
|
53
59
|
}
|
|
@@ -31,7 +31,7 @@ export const ListItem = JSX<ListItemProps>(
|
|
|
31
31
|
({ className = '', isDotted = true, children, version = 'primary' }) => {
|
|
32
32
|
return (
|
|
33
33
|
<div className={`font-sans flex items-start ${className}`} role="listitem">
|
|
34
|
-
{isDotted
|
|
34
|
+
{isDotted ? <div className={getListStyle(version)} /> : null}
|
|
35
35
|
<span>{children}</span>
|
|
36
36
|
</div>
|
|
37
37
|
);
|
package/package.json
CHANGED
|
@@ -29,7 +29,9 @@ export const HeaderCell = JSX<HeaderCellProps>(({ icon, image, title, link }) =>
|
|
|
29
29
|
/>
|
|
30
30
|
)}
|
|
31
31
|
{image?.src && <Img className="mb-[18px]" image={image} />}
|
|
32
|
-
{title
|
|
32
|
+
{title ? (
|
|
33
|
+
<Heading headingType="h4" as="h3" className="text-center text-white" title={title} />
|
|
34
|
+
) : null}
|
|
33
35
|
{link?.text && (
|
|
34
36
|
<div className="mt-auto w-full">
|
|
35
37
|
<Button
|
|
@@ -2,6 +2,7 @@ import { JSX, PropsWithChildren } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import type { BlockDef, ContentPageDef, UniBlockProps } from '../../types';
|
|
3
3
|
import { changeHashOnScroll } from '../../utils/changeHashOnScroll';
|
|
4
4
|
import { isSSR } from '../../utils/isSSR';
|
|
5
|
+
import { style2className } from '../../utils/style2className';
|
|
5
6
|
import type { BlockContent } from '../BlockContent';
|
|
6
7
|
import { LikeControl } from '../LikeControl/LikeControl';
|
|
7
8
|
import { Placeholder } from '../Placeholder/Placeholder';
|
|
@@ -128,7 +129,3 @@ function renderBlock(
|
|
|
128
129
|
`block-${i}`,
|
|
129
130
|
);
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
-
function style2className(style: string[] | undefined | null): string {
|
|
133
|
-
return style ? style.join(' ') : '';
|
|
134
|
-
}
|
|
@@ -13,13 +13,13 @@ export const ContentPageHead = JSX<ContentPageHeadProps>(({ HeadComponent, data,
|
|
|
13
13
|
<HeadComponent>
|
|
14
14
|
<title>{title}</title>
|
|
15
15
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
16
|
-
{description
|
|
17
|
-
{keywords
|
|
18
|
-
{robots
|
|
16
|
+
{description ? <meta name="description" content={description} /> : null}
|
|
17
|
+
{keywords ? <meta name="keywords" content={keywords.join(',')} /> : null}
|
|
18
|
+
{robots ? <meta name="robots" content={robots.join(',')} /> : null}
|
|
19
19
|
{renderOpenGraph(og)}
|
|
20
20
|
{renderTwitter(twitter)}
|
|
21
|
-
{canonical
|
|
22
|
-
{jsonLd
|
|
21
|
+
{canonical ? <link rel="canonical" href={canonical} /> : null}
|
|
22
|
+
{jsonLd ? <script type="application/ld+json">{jsonLd}</script> : null}
|
|
23
23
|
{children}
|
|
24
24
|
</HeadComponent>
|
|
25
25
|
);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { ContentPageDef, CustomPageTemplate, UniBlockProps } from '../../types';
|
|
3
|
+
import { style2className } from '../../utils/style2className';
|
|
4
|
+
import { ContentPageContext } from './ContentPageContext';
|
|
5
|
+
|
|
6
|
+
interface PageDecoratorProps<VNode> {
|
|
7
|
+
pageClassName: string;
|
|
8
|
+
pageTemplate: CustomPageTemplate;
|
|
9
|
+
render: (props: { pageClassName: string; pageTemplate: CustomPageTemplate }) => VNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type PageDecorator<VNode = any> = (
|
|
13
|
+
props: PageDecoratorProps<VNode>,
|
|
14
|
+
index?: number | string,
|
|
15
|
+
) => any;
|
|
16
|
+
|
|
17
|
+
export interface PageTemplate {
|
|
18
|
+
name: string;
|
|
19
|
+
template: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type PageTemplatesRegistry = Record<string, PageTemplate>;
|
|
23
|
+
|
|
24
|
+
export interface CustomContentPageProps extends UniBlockProps {
|
|
25
|
+
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
26
|
+
data: ContentPageDef;
|
|
27
|
+
pageDecorator?: PageDecorator;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RenderPageFunc {
|
|
31
|
+
pageTemplate: CustomPageTemplate;
|
|
32
|
+
pageClassName: string;
|
|
33
|
+
pageDecorator: PageDecorator;
|
|
34
|
+
pageTemplatesRegistry: PageTemplatesRegistry;
|
|
35
|
+
context: ContentPageContext;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const defaultPageDecorator: PageDecorator = ({ pageClassName, pageTemplate, render }) =>
|
|
39
|
+
render({ pageClassName, pageTemplate });
|
|
40
|
+
|
|
41
|
+
export const CustomContentPage = JSX<CustomContentPageProps>(
|
|
42
|
+
({
|
|
43
|
+
className = '',
|
|
44
|
+
context,
|
|
45
|
+
pageTemplatesRegistry,
|
|
46
|
+
data: { style: pageStyle, customPageTmpl: pageTemplate },
|
|
47
|
+
pageDecorator = defaultPageDecorator,
|
|
48
|
+
}) => {
|
|
49
|
+
return pageTemplate
|
|
50
|
+
? renderPage({
|
|
51
|
+
pageTemplate,
|
|
52
|
+
pageClassName: `${style2className(pageStyle)} ${className}`,
|
|
53
|
+
pageDecorator,
|
|
54
|
+
pageTemplatesRegistry,
|
|
55
|
+
context,
|
|
56
|
+
})
|
|
57
|
+
: null;
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
function renderPage({
|
|
62
|
+
pageTemplate,
|
|
63
|
+
pageClassName,
|
|
64
|
+
pageDecorator,
|
|
65
|
+
pageTemplatesRegistry,
|
|
66
|
+
context,
|
|
67
|
+
}: RenderPageFunc) {
|
|
68
|
+
const { type } = pageTemplate;
|
|
69
|
+
if (!(type && type in pageTemplatesRegistry) || !pageTemplatesRegistry[type].template) {
|
|
70
|
+
throw new Error(`No page template with "${type}" is registered`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const { template: PageComponent } = pageTemplatesRegistry[type];
|
|
74
|
+
return pageDecorator({
|
|
75
|
+
pageClassName,
|
|
76
|
+
pageTemplate,
|
|
77
|
+
render: (props) => {
|
|
78
|
+
const { content } = props.pageTemplate;
|
|
79
|
+
return <PageComponent className={props.pageClassName} context={context} {...content} />;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -98,7 +98,7 @@ function renderItems(items: GalleryItem[], version: BlockVersion = 'primary', is
|
|
|
98
98
|
<section className="mt-3">
|
|
99
99
|
{items.map((item, i) => (
|
|
100
100
|
<div key={String(i)}>
|
|
101
|
-
{isDotted
|
|
101
|
+
{isDotted ? <div className={getListStyle(version)} /> : null}
|
|
102
102
|
<span className="text-m-md font-medium">{item.title}</span>
|
|
103
103
|
<span className={`text-m-sm pl-2 ${version === 'primary' ? 'text-secondary-text' : ''}`}>
|
|
104
104
|
{item.text}
|
|
@@ -6,16 +6,18 @@ import { OtherProductsItem } from './OtherProductsItem';
|
|
|
6
6
|
export interface OtherProductsProps extends OtherProductsContent, UniBlockProps {}
|
|
7
7
|
|
|
8
8
|
export const OtherProducts = JSX<OtherProductsProps>(
|
|
9
|
-
({ blockItems, colorPalette, context, className =
|
|
9
|
+
({ blockItems, colorPalette, context, className = '' }) => {
|
|
10
10
|
return (
|
|
11
|
-
<section
|
|
12
|
-
data-theme={colorPalette || null}
|
|
13
|
-
className={`font-sans bg-white text-primary-text ${className}`}
|
|
14
|
-
>
|
|
11
|
+
<section className={`font-sans bg-white text-primary-text ${className}`}>
|
|
15
12
|
{blockItems?.length ? (
|
|
16
13
|
<div className="list-none m-0 p-0">
|
|
17
14
|
{blockItems.map((item, i) => (
|
|
18
|
-
<OtherProductsItem
|
|
15
|
+
<OtherProductsItem
|
|
16
|
+
key={`BlockItem${i}`}
|
|
17
|
+
{...item}
|
|
18
|
+
dataTheme={colorPalette}
|
|
19
|
+
context={context}
|
|
20
|
+
/>
|
|
19
21
|
))}
|
|
20
22
|
</div>
|
|
21
23
|
) : null}
|
|
@@ -4,11 +4,14 @@ import { Icon } from '../../ui-kit/Icon/Icon';
|
|
|
4
4
|
import type { BlockItemCommonProps } from './OtherProductsContent';
|
|
5
5
|
import { OtherProductsItemInner } from './OtherProductsItemInner';
|
|
6
6
|
import { useActiveHandler } from './useActiveHandler';
|
|
7
|
+
import { ColorPalette } from '../../types';
|
|
7
8
|
|
|
8
|
-
export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
|
|
9
|
+
export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
|
|
10
|
+
dataTheme?: ColorPalette;
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
export const OtherProductsItem = JSX<BlockItemProps>(
|
|
11
|
-
({ label, isExpanded, blocks, columns, context }) => {
|
|
14
|
+
({ label, isExpanded, blocks, columns, dataTheme = null, context }) => {
|
|
12
15
|
const { hasContent, icon, handleToggle, isActive } = useActiveHandler({
|
|
13
16
|
context,
|
|
14
17
|
blocks,
|
|
@@ -27,6 +30,7 @@ export const OtherProductsItem = JSX<BlockItemProps>(
|
|
|
27
30
|
) : null}
|
|
28
31
|
<button
|
|
29
32
|
className="border-none bg-primary-main px-0 py-[26px] mb-[1px] w-full font-sans text-white text-base flex justify-center cursor-pointer"
|
|
33
|
+
data-theme={dataTheme}
|
|
30
34
|
onClick={handleToggle}
|
|
31
35
|
>
|
|
32
36
|
<span className="pr-3">{isActive ? 'Скрыть' : label}</span>
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"size": {
|
|
13
13
|
"width": 234,
|
|
14
14
|
"height": 234
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
|
+
"alt": "",
|
|
17
|
+
"title": ""
|
|
16
18
|
},
|
|
17
19
|
"items": [
|
|
18
20
|
"Элемент списка 1",
|
|
@@ -23,7 +25,12 @@
|
|
|
23
25
|
"buttons": [
|
|
24
26
|
{
|
|
25
27
|
"text": "Кнопка",
|
|
26
|
-
"version": "secondary"
|
|
28
|
+
"version": "secondary",
|
|
29
|
+
"target": "",
|
|
30
|
+
"icon": {
|
|
31
|
+
"alt": "",
|
|
32
|
+
"title": ""
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
],
|
|
29
36
|
"version": "primary",
|
|
@@ -57,7 +57,9 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
57
57
|
}
|
|
58
58
|
image={image?.src && <Img className="mt-auto ml-7" image={image} />}
|
|
59
59
|
>
|
|
60
|
-
{description
|
|
60
|
+
{description ? (
|
|
61
|
+
<Description className="mt-4 max-w-[600px]" description={description} />
|
|
62
|
+
) : null}
|
|
61
63
|
<div className="flex mt-5 mb-1">
|
|
62
64
|
{benefits?.length ? (
|
|
63
65
|
<div className="mr-8">{benefits.map(renderBenefitLabel)}</div>
|
|
@@ -34,7 +34,7 @@ const renderCellInner = (
|
|
|
34
34
|
{label ? <div className="text-xl font-medium m-0">{label}</div> : null}
|
|
35
35
|
{description ? <div className="text-sm text-secondary-text">{description}</div> : null}
|
|
36
36
|
{list?.items?.length ? renderList(list) : null}
|
|
37
|
-
{image
|
|
37
|
+
{image ? <Img image={image} /> : null}
|
|
38
38
|
{buttons?.length ? renderButtons(buttons) : null}
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
@@ -33,7 +33,7 @@ const renderCellInner = (
|
|
|
33
33
|
<div className="text-m-sm text-secondary-text mt-[3px]">{description}</div>
|
|
34
34
|
) : null}
|
|
35
35
|
{list?.items?.length ? renderList(list) : null}
|
|
36
|
-
{image
|
|
36
|
+
{image ? <Img image={{ ...image, className: 'm-0' }} /> : null}
|
|
37
37
|
{buttons?.length ? renderButtons(buttons) : null}
|
|
38
38
|
</div>
|
|
39
39
|
);
|
|
@@ -7,13 +7,20 @@
|
|
|
7
7
|
"format": "webp",
|
|
8
8
|
"size": {
|
|
9
9
|
"width": 445
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"alt": "",
|
|
12
|
+
"title": ""
|
|
11
13
|
},
|
|
12
14
|
"items": ["Пункт 1", "Пункт 2", "Пункт 3"],
|
|
13
15
|
"buttons": [
|
|
14
16
|
{
|
|
15
17
|
"text": "Кнопка",
|
|
16
|
-
"version": "primary"
|
|
18
|
+
"version": "primary",
|
|
19
|
+
"target": "",
|
|
20
|
+
"icon": {
|
|
21
|
+
"alt": "",
|
|
22
|
+
"title": ""
|
|
23
|
+
}
|
|
17
24
|
}
|
|
18
25
|
],
|
|
19
26
|
"version": "primary"
|
package/src/types.ts
CHANGED
|
@@ -44,10 +44,16 @@ export interface ContentPageMeta {
|
|
|
44
44
|
jsonLd?: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export interface CustomPageTemplate {
|
|
48
|
+
content?: Record<string, any>;
|
|
49
|
+
type?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
export interface ContentPageDef extends ContentPageMeta {
|
|
48
53
|
style?: string[];
|
|
49
|
-
blocks?: BlockDef[];
|
|
54
|
+
blocks?: BlockDef[];
|
|
50
55
|
slots?: SlotsMap;
|
|
56
|
+
customPageTmpl?: CustomPageTemplate;
|
|
51
57
|
likeControl?: boolean;
|
|
52
58
|
colorPalette?: ColorPalette;
|
|
53
59
|
}
|
|
@@ -60,7 +60,6 @@ export const RegularButton = JSX<ButtonCommonProps>(
|
|
|
60
60
|
onClick={onClick}
|
|
61
61
|
aria-label={ariaLabel}
|
|
62
62
|
role={href ? 'link' : 'button'}
|
|
63
|
-
data-theme={getColorPalette()}
|
|
64
63
|
{...rest}
|
|
65
64
|
>
|
|
66
65
|
{children}
|
|
@@ -80,15 +79,9 @@ const DisabledButton = JSX<ButtonCommonProps>(
|
|
|
80
79
|
className={`inline-block ${buttonStyle} ${buttonDisabledStyleMap[version] || ''} ${
|
|
81
80
|
rounded ? 'rounded-full' : 'rounded-md'
|
|
82
81
|
} ${className || ''}`}
|
|
83
|
-
data-theme={getColorPalette()}
|
|
84
82
|
>
|
|
85
83
|
{children}
|
|
86
84
|
</div>
|
|
87
85
|
);
|
|
88
86
|
},
|
|
89
87
|
);
|
|
90
|
-
|
|
91
|
-
const getColorPalette = () => {
|
|
92
|
-
const currentTheme = globalThis?.document?.querySelector('[data-theme]');
|
|
93
|
-
return currentTheme?.getAttribute('data-theme') || 'pc';
|
|
94
|
-
};
|
|
@@ -31,7 +31,7 @@ export const ListItem = JSX<ListItemProps>(
|
|
|
31
31
|
({ className = '', isDotted = true, children, version = 'primary' }) => {
|
|
32
32
|
return (
|
|
33
33
|
<div className={`font-sans flex items-start ${className}`} role="listitem">
|
|
34
|
-
{isDotted
|
|
34
|
+
{isDotted ? <div className={getListStyle(version)} /> : null}
|
|
35
35
|
<span>{children}</span>
|
|
36
36
|
</div>
|
|
37
37
|
);
|