@redneckz/wildless-cms-uni-blocks 0.3.62 → 0.3.64
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/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +87 -26
- package/bundle/bundle.umd.min.js +1 -1
- package/cosmos-static/icons/AirPlane.svg +1 -0
- package/cosmos-static/icons/CarIcon.svg +1 -0
- package/cosmos-static/icons/CinemaIcon.svg +1 -0
- package/cosmos-static/icons/DocsIcon.svg +1 -0
- package/cosmos-static/icons/PowerIcon.svg +1 -0
- package/cosmos-static/icons/PumpkinIcon.svg +1 -0
- package/cosmos-static/icons/SoundIcon.svg +1 -0
- package/cosmos-static/icons/WateringCan.svg +1 -0
- package/dist/components/Accordion/Accordion.js +7 -2
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/AccordionContent.d.ts +3 -0
- package/dist/components/BaseTile/BaseTileProps.d.ts +1 -9
- package/dist/components/BenefitsBlock/BenefitsBlock.js +3 -3
- package/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/dist/components/BlockContent.d.ts +2 -1
- package/dist/components/Blocks.d.ts +1 -0
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +14 -0
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
- package/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
- package/dist/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
- package/dist/components/BonusBenefitsBlock/getElementsColsValue.js +17 -0
- package/dist/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
- package/dist/components/Headline/HeadlineContent.d.ts +1 -1
- package/dist/components/Headline/constants.d.ts +1 -1
- package/dist/components/LinkDocs/LinkDocsContent.d.ts +1 -1
- package/dist/components/OtherProducts/OtherProductsContent.d.ts +1 -1
- package/dist/components/OtherProducts/OtherProductsItem.d.ts +1 -2
- package/dist/components/OtherProducts/OtherProductsItem.js +10 -7
- package/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/dist/components/TariffsTable/TariffsTable.js +8 -3
- package/dist/components/TariffsTable/TariffsTable.js.map +1 -1
- package/dist/components/TariffsTable/TariffsTableContent.d.ts +7 -5
- package/dist/content-page-repository/ContentPageRepository.js +1 -1
- package/dist/content-page-repository/ContentPageRepository.js.map +1 -1
- package/dist/icons/IconName.d.ts +22 -6
- package/dist/icons/IconName.js +18 -2
- package/dist/icons/IconName.js.map +1 -1
- package/dist/model/AlignType.d.ts +9 -0
- package/dist/model/AlignType.js +2 -0
- package/dist/model/AlignType.js.map +1 -0
- package/dist/model/VNode.d.ts +1 -0
- package/dist/model/VNode.js +2 -0
- package/dist/model/VNode.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/ui-kit/Foldable/Foldable.d.ts +20 -0
- package/dist/ui-kit/Foldable/Foldable.js +22 -0
- package/dist/ui-kit/Foldable/Foldable.js.map +1 -0
- package/dist/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
- package/dist/ui-kit/Foldable/useActiveHandler.js +22 -0
- package/dist/ui-kit/Foldable/useActiveHandler.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/Accordion/Accordion.fixture.d.ts +1 -0
- package/lib/components/Accordion/Accordion.js +7 -2
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/AccordionContent.d.ts +3 -0
- package/lib/components/BaseTile/BaseTileProps.d.ts +1 -9
- package/lib/components/BenefitsBlock/BenefitsBlock.js +3 -3
- package/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/lib/components/BlockContent.d.ts +2 -1
- package/lib/components/Blocks.d.ts +1 -0
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.d.ts +4 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +12 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
- package/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
- package/lib/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
- package/lib/components/BonusBenefitsBlock/getElementsColsValue.js +14 -0
- package/lib/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
- package/lib/components/Headline/HeadlineContent.d.ts +1 -1
- package/lib/components/Headline/constants.d.ts +1 -1
- package/lib/components/LinkDocs/LinkDocsContent.d.ts +1 -1
- package/lib/components/OtherProducts/OtherProductsContent.d.ts +1 -1
- package/lib/components/OtherProducts/OtherProductsItem.d.ts +1 -2
- package/lib/components/OtherProducts/OtherProductsItem.js +11 -8
- package/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/lib/components/TariffsTable/TariffsTable.js +8 -3
- package/lib/components/TariffsTable/TariffsTable.js.map +1 -1
- package/lib/components/TariffsTable/TariffsTableContent.d.ts +7 -5
- package/lib/content-page-repository/ContentPageRepository.js +1 -1
- package/lib/content-page-repository/ContentPageRepository.js.map +1 -1
- package/lib/icons/IconName.d.ts +22 -6
- package/lib/icons/IconName.js +18 -2
- package/lib/icons/IconName.js.map +1 -1
- package/lib/model/AlignType.d.ts +9 -0
- package/lib/model/AlignType.js +2 -0
- package/lib/model/AlignType.js.map +1 -0
- package/lib/model/VNode.d.ts +1 -0
- package/lib/model/VNode.js +2 -0
- package/lib/model/VNode.js.map +1 -0
- package/lib/types.d.ts +1 -0
- package/lib/ui-kit/Foldable/Foldable.d.ts +20 -0
- package/lib/ui-kit/Foldable/Foldable.js +20 -0
- package/lib/ui-kit/Foldable/Foldable.js.map +1 -0
- package/lib/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
- package/lib/ui-kit/Foldable/useActiveHandler.js +19 -0
- package/lib/ui-kit/Foldable/useActiveHandler.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +18 -2
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Accordion/AccordionContent.d.ts +3 -0
- package/mobile/dist/components/BaseTile/BaseTileProps.d.ts +1 -9
- package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js +3 -3
- package/mobile/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/mobile/dist/components/BlockContent.d.ts +2 -1
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js +14 -0
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
- package/mobile/dist/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
- package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
- package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.js +17 -0
- package/mobile/dist/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
- package/mobile/dist/components/Headline/HeadlineContent.d.ts +1 -1
- package/mobile/dist/components/Headline/constants.d.ts +1 -1
- package/mobile/dist/components/LinkDocs/LinkDocsContent.d.ts +1 -1
- package/mobile/dist/components/OtherProducts/OtherProductsContent.d.ts +1 -1
- package/mobile/dist/components/OtherProducts/OtherProductsItem.d.ts +1 -2
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js +10 -7
- package/mobile/dist/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/dist/components/TariffsTable/TariffsTableContent.d.ts +7 -5
- package/mobile/dist/content-page-repository/ContentPageRepository.js +1 -1
- package/mobile/dist/content-page-repository/ContentPageRepository.js.map +1 -1
- package/mobile/dist/icons/IconName.d.ts +22 -6
- package/mobile/dist/icons/IconName.js +18 -2
- package/mobile/dist/icons/IconName.js.map +1 -1
- package/mobile/dist/model/AlignType.d.ts +9 -0
- package/mobile/dist/model/AlignType.js +2 -0
- package/mobile/dist/model/AlignType.js.map +1 -0
- package/mobile/dist/model/VNode.d.ts +1 -0
- package/mobile/dist/model/VNode.js +2 -0
- package/mobile/dist/model/VNode.js.map +1 -0
- package/mobile/dist/types.d.ts +1 -0
- package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +20 -0
- package/mobile/dist/ui-kit/Foldable/Foldable.js +22 -0
- package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -0
- package/mobile/dist/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
- package/mobile/dist/ui-kit/Foldable/useActiveHandler.js +22 -0
- package/mobile/dist/ui-kit/Foldable/useActiveHandler.js.map +1 -0
- package/mobile/lib/components/Accordion/AccordionContent.d.ts +3 -0
- package/mobile/lib/components/BaseTile/BaseTileProps.d.ts +1 -9
- package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js +3 -3
- package/mobile/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/mobile/lib/components/BlockContent.d.ts +2 -1
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.d.ts +5 -0
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js +12 -0
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlock.js.map +1 -0
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.d.ts +21 -0
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js +2 -0
- package/mobile/lib/components/BonusBenefitsBlock/BonusBenefitsBlockContent.js.map +1 -0
- package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.d.ts +1 -0
- package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.js +14 -0
- package/mobile/lib/components/BonusBenefitsBlock/getElementsColsValue.js.map +1 -0
- package/mobile/lib/components/Headline/HeadlineContent.d.ts +1 -1
- package/mobile/lib/components/Headline/constants.d.ts +1 -1
- package/mobile/lib/components/LinkDocs/LinkDocsContent.d.ts +1 -1
- package/mobile/lib/components/OtherProducts/OtherProductsContent.d.ts +1 -1
- package/mobile/lib/components/OtherProducts/OtherProductsItem.d.ts +1 -2
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js +11 -8
- package/mobile/lib/components/OtherProducts/OtherProductsItem.js.map +1 -1
- package/mobile/lib/components/TariffsTable/TariffsTableContent.d.ts +7 -5
- package/mobile/lib/content-page-repository/ContentPageRepository.js +1 -1
- package/mobile/lib/content-page-repository/ContentPageRepository.js.map +1 -1
- package/mobile/lib/icons/IconName.d.ts +22 -6
- package/mobile/lib/icons/IconName.js +18 -2
- package/mobile/lib/icons/IconName.js.map +1 -1
- package/mobile/lib/model/AlignType.d.ts +9 -0
- package/mobile/lib/model/AlignType.js +2 -0
- package/mobile/lib/model/AlignType.js.map +1 -0
- package/mobile/lib/model/VNode.d.ts +1 -0
- package/mobile/lib/model/VNode.js +2 -0
- package/mobile/lib/model/VNode.js.map +1 -0
- package/mobile/lib/types.d.ts +1 -0
- package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +20 -0
- package/mobile/lib/ui-kit/Foldable/Foldable.js +20 -0
- package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -0
- package/mobile/lib/ui-kit/Foldable/useActiveHandler.d.ts +11 -0
- package/mobile/lib/ui-kit/Foldable/useActiveHandler.js +19 -0
- package/mobile/lib/ui-kit/Foldable/useActiveHandler.js.map +1 -0
- package/mobile/src/components/Accordion/AccordionContent.ts +3 -0
- package/mobile/src/components/BaseTile/BaseTileProps.ts +1 -10
- package/mobile/src/components/BenefitsBlock/BenefitsBlock.tsx +6 -8
- package/mobile/src/components/BlockContent.ts +3 -1
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +54 -0
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +49 -0
- package/mobile/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +23 -0
- package/mobile/src/components/BonusBenefitsBlock/getElementsColsValue.ts +12 -0
- package/mobile/src/components/Headline/HeadlineContent.ts +1 -1
- package/mobile/src/components/Headline/constants.ts +1 -1
- package/mobile/src/components/LinkDocs/LinkDocsContent.ts +1 -1
- package/mobile/src/components/OtherProducts/OtherProductsContent.ts +1 -1
- package/mobile/src/components/OtherProducts/OtherProductsItem.tsx +33 -23
- package/mobile/src/components/TariffsTable/TariffsTableContent.ts +7 -5
- package/mobile/src/content-page-repository/ContentPageRepository.ts +1 -1
- package/mobile/src/icons/AirPlane.svg +98 -0
- package/mobile/src/icons/ArrowUpIcon.svg +1 -1
- package/mobile/src/icons/ArrowsRewindRight.svg +1 -1
- package/mobile/src/icons/CarIcon.svg +466 -0
- package/mobile/src/icons/CinemaIcon.svg +274 -0
- package/mobile/src/icons/DocsIcon.svg +238 -0
- package/mobile/src/icons/IconName.ts +4 -4
- package/mobile/src/icons/PowerIcon.svg +135 -0
- package/mobile/src/icons/PumpkinIcon.svg +236 -0
- package/mobile/src/icons/SoundIcon.svg +113 -0
- package/mobile/src/icons/WateringCan.svg +497 -0
- package/mobile/src/model/AlignType.ts +9 -0
- package/mobile/src/model/VNode.ts +1 -0
- package/mobile/src/types.ts +1 -0
- package/mobile/src/ui-kit/Foldable/Foldable.tsx +81 -0
- package/mobile/src/ui-kit/Foldable/useActiveHandler.ts +34 -0
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.fixture.tsx +24 -2
- package/src/components/Accordion/Accordion.tsx +23 -2
- package/src/components/Accordion/AccordionContent.ts +3 -0
- package/src/components/BaseTile/BaseTileProps.ts +1 -10
- package/src/components/BenefitsBlock/BenefitsBlock.tsx +6 -8
- package/src/components/BlockContent.ts +3 -1
- package/src/components/Blocks.ts +2 -0
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.example.json +54 -0
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.fixture.tsx +50 -0
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlock.tsx +49 -0
- package/src/components/BonusBenefitsBlock/BonusBenefitsBlockContent.ts +23 -0
- package/src/components/BonusBenefitsBlock/getElementsColsValue.ts +12 -0
- package/src/components/Headline/HeadlineContent.ts +1 -1
- package/src/components/Headline/constants.ts +1 -1
- package/src/components/LinkDocs/LinkDocs.tsx +1 -1
- package/src/components/LinkDocs/LinkDocsContent.ts +1 -1
- package/src/components/OtherProducts/OtherProductsContent.ts +1 -1
- package/src/components/OtherProducts/OtherProductsItem.tsx +33 -23
- package/src/components/TariffsTable/TariffsTable.fixture.tsx +4 -1
- package/src/components/TariffsTable/TariffsTable.tsx +55 -18
- package/src/components/TariffsTable/TariffsTableContent.ts +7 -5
- package/src/content-page-repository/ContentPageRepository.ts +1 -1
- package/src/icons/AirPlane.svg +98 -0
- package/src/icons/ArrowUpIcon.svg +1 -1
- package/src/icons/ArrowsRewindRight.svg +1 -1
- package/src/icons/CarIcon.svg +466 -0
- package/src/icons/CinemaIcon.svg +274 -0
- package/src/icons/DocsIcon.svg +238 -0
- package/src/icons/IconName.ts +28 -4
- package/src/icons/PowerIcon.svg +135 -0
- package/src/icons/PumpkinIcon.svg +236 -0
- package/src/icons/SoundIcon.svg +113 -0
- package/src/icons/WateringCan.svg +497 -0
- package/src/model/AlignType.ts +9 -0
- package/src/model/VNode.ts +1 -0
- package/src/types.ts +1 -0
- package/src/ui-kit/Foldable/Foldable.tsx +81 -0
- package/src/ui-kit/Foldable/useActiveHandler.ts +34 -0
- package/dist/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
- package/dist/components/OtherProducts/OtherProductsItemInner.js +0 -10
- package/dist/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
- package/dist/components/OtherProducts/useActiveHandler.d.ts +0 -7
- package/dist/components/OtherProducts/useActiveHandler.js +0 -21
- package/dist/components/OtherProducts/useActiveHandler.js.map +0 -1
- package/lib/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
- package/lib/components/OtherProducts/OtherProductsItemInner.js +0 -8
- package/lib/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
- package/lib/components/OtherProducts/useActiveHandler.d.ts +0 -7
- package/lib/components/OtherProducts/useActiveHandler.js +0 -18
- package/lib/components/OtherProducts/useActiveHandler.js.map +0 -1
- package/mobile/dist/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
- package/mobile/dist/components/OtherProducts/OtherProductsItemInner.js +0 -10
- package/mobile/dist/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
- package/mobile/dist/components/OtherProducts/useActiveHandler.d.ts +0 -7
- package/mobile/dist/components/OtherProducts/useActiveHandler.js +0 -21
- package/mobile/dist/components/OtherProducts/useActiveHandler.js.map +0 -1
- package/mobile/lib/components/OtherProducts/OtherProductsItemInner.d.ts +0 -2
- package/mobile/lib/components/OtherProducts/OtherProductsItemInner.js +0 -8
- package/mobile/lib/components/OtherProducts/OtherProductsItemInner.js.map +0 -1
- package/mobile/lib/components/OtherProducts/useActiveHandler.d.ts +0 -7
- package/mobile/lib/components/OtherProducts/useActiveHandler.js +0 -18
- package/mobile/lib/components/OtherProducts/useActiveHandler.js.map +0 -1
- package/mobile/src/components/OtherProducts/OtherProductsItemInner.tsx +0 -14
- package/mobile/src/components/OtherProducts/useActiveHandler.ts +0 -24
- package/src/components/OtherProducts/OtherProductsItemInner.tsx +0 -14
- package/src/components/OtherProducts/useActiveHandler.ts +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type VNode = unknown;
|
package/mobile/src/types.ts
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
3
|
+
import type { VNode } from '../../model/VNode';
|
|
4
|
+
import { ColorPalette } from '../../types';
|
|
5
|
+
import { clamp } from '../../utils/clamp';
|
|
6
|
+
import { Icon } from '../Icon/Icon';
|
|
7
|
+
import { foldableBlockClassNames, useActiveHandler } from './useActiveHandler';
|
|
8
|
+
|
|
9
|
+
export type FoldableBlocks = VNode[];
|
|
10
|
+
export type Render = (_: VNode, isActive: boolean) => VNode;
|
|
11
|
+
export interface FoldableProps {
|
|
12
|
+
context: ContentPageContext;
|
|
13
|
+
foldButtonLabel?: string;
|
|
14
|
+
hiddenBlocksNum?: number;
|
|
15
|
+
blocks?: FoldableBlocks;
|
|
16
|
+
foldButtonClasses?: string;
|
|
17
|
+
foldButtonDataTheme?: ColorPalette;
|
|
18
|
+
isUnfolded?: boolean;
|
|
19
|
+
render?: Render;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface RenderBlocksParams {
|
|
23
|
+
blocksToHide: number;
|
|
24
|
+
isActive: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const Foldable = JSX<FoldableProps>(
|
|
28
|
+
({
|
|
29
|
+
blocks = [],
|
|
30
|
+
context,
|
|
31
|
+
hiddenBlocksNum = 0,
|
|
32
|
+
foldButtonClasses,
|
|
33
|
+
foldButtonLabel,
|
|
34
|
+
foldButtonDataTheme,
|
|
35
|
+
isUnfolded,
|
|
36
|
+
render = (_) => _,
|
|
37
|
+
}) => {
|
|
38
|
+
const blocksToHide = clamp(hiddenBlocksNum, 0, blocks.length);
|
|
39
|
+
|
|
40
|
+
const { icon, handleToggle, isActive } = useActiveHandler({
|
|
41
|
+
context,
|
|
42
|
+
initialState: isUnfolded,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return blocks ? (
|
|
46
|
+
<div>
|
|
47
|
+
{renderBlocks(blocks, render, { blocksToHide, isActive })}
|
|
48
|
+
{hiddenBlocksNum ? (
|
|
49
|
+
<button
|
|
50
|
+
className={
|
|
51
|
+
foldButtonClasses ||
|
|
52
|
+
'border-none bg-primary-main px-0 py-[26px] mb-[1px] w-full font-sans text-white text-base flex justify-center cursor-pointer'
|
|
53
|
+
}
|
|
54
|
+
data-theme={foldButtonDataTheme}
|
|
55
|
+
onClick={handleToggle}
|
|
56
|
+
>
|
|
57
|
+
<span className="pr-3">{isActive ? 'Скрыть' : foldButtonLabel}</span>
|
|
58
|
+
<Icon name={icon} width="20" height="20" asSVG />
|
|
59
|
+
</button>
|
|
60
|
+
) : null}
|
|
61
|
+
</div>
|
|
62
|
+
) : null;
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const renderBlocks = (
|
|
67
|
+
blocks: FoldableBlocks,
|
|
68
|
+
render: Render,
|
|
69
|
+
{ blocksToHide, isActive }: RenderBlocksParams,
|
|
70
|
+
) => {
|
|
71
|
+
const visibleBlocks = blocks.slice(0, blocks.length - blocksToHide);
|
|
72
|
+
const hiddenBlocks = blocks.slice(-blocksToHide);
|
|
73
|
+
|
|
74
|
+
return render(
|
|
75
|
+
<div>
|
|
76
|
+
{visibleBlocks}
|
|
77
|
+
<div className={foldableBlockClassNames}>{hiddenBlocks}</div>
|
|
78
|
+
</div>,
|
|
79
|
+
isActive,
|
|
80
|
+
);
|
|
81
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
2
|
+
import type { IconName } from '../../icons/IconName';
|
|
3
|
+
|
|
4
|
+
export const foldableBlockClassNames = 'transition-all duration-300 max-h-0 overflow-hidden';
|
|
5
|
+
|
|
6
|
+
export interface ActiveHandler {
|
|
7
|
+
context: ContentPageContext;
|
|
8
|
+
initialState?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const useActiveHandler = ({ context, initialState = false }: ActiveHandler) => {
|
|
12
|
+
const [isActive, setIsActive] = context.useState(initialState);
|
|
13
|
+
const icon: IconName = isActive ? 'ArrowUpIcon' : 'ArrowDownIcon';
|
|
14
|
+
|
|
15
|
+
const handleToggle = (e: MouseEvent) => {
|
|
16
|
+
const currentTarget = e.currentTarget as HTMLElement;
|
|
17
|
+
|
|
18
|
+
if (!currentTarget) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setIsActive(!isActive);
|
|
23
|
+
const wrapperBlock = currentTarget.previousSibling as HTMLElement;
|
|
24
|
+
const contentBlock = wrapperBlock.getElementsByClassName(
|
|
25
|
+
foldableBlockClassNames,
|
|
26
|
+
)[0] as HTMLElement;
|
|
27
|
+
|
|
28
|
+
contentBlock.style.maxHeight = contentBlock.style.maxHeight
|
|
29
|
+
? ''
|
|
30
|
+
: `${contentBlock.scrollHeight}px`;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return { icon, handleToggle, isActive };
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@ const MINI_GALLERY_ACCORDION_BLOCK: MiniGalleryBlockListDef = {
|
|
|
61
61
|
...MINI_GALLERY,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
const
|
|
64
|
+
const propsDefaultBlock: AccordionProps = {
|
|
65
65
|
context,
|
|
66
66
|
title: 'Accordion title',
|
|
67
67
|
description: 'Accordion description',
|
|
@@ -101,10 +101,32 @@ const propsBlock: AccordionProps = {
|
|
|
101
101
|
],
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
+
const propsRightAlignTitleBlock: AccordionProps = {
|
|
105
|
+
context,
|
|
106
|
+
title: 'Accordion title',
|
|
107
|
+
accordionAlignTitle: 'right',
|
|
108
|
+
description: 'Accordion description',
|
|
109
|
+
accordionItems: [
|
|
110
|
+
{
|
|
111
|
+
label: 'Accordion label 1',
|
|
112
|
+
blocks: [TEXT_BLOCK_ACCORDION_BLOCK, TEXT_BLOCK_ACCORDION_BLOCK],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: 'Accordion label 2',
|
|
116
|
+
blocks: [PICTURE_TEXT_ACCORDION_BLOCK],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
|
|
104
121
|
export default {
|
|
105
122
|
default: (
|
|
106
123
|
<div className="container grid grid-cols-12">
|
|
107
|
-
<Accordion className="col-span-12" {...
|
|
124
|
+
<Accordion className="col-span-12" {...propsDefaultBlock} />
|
|
125
|
+
</div>
|
|
126
|
+
),
|
|
127
|
+
'right-align-title': (
|
|
128
|
+
<div className="container grid grid-cols-12">
|
|
129
|
+
<Accordion className="col-span-12" {...propsRightAlignTitleBlock} />
|
|
108
130
|
</div>
|
|
109
131
|
),
|
|
110
132
|
};
|
|
@@ -3,14 +3,35 @@ import type { UniBlockProps } from '../../types';
|
|
|
3
3
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
4
4
|
import type { AccordionContent } from './AccordionContent';
|
|
5
5
|
import { AccordionItem } from './AccordionItem';
|
|
6
|
+
import { AlignType } from '../../model/AlignType';
|
|
7
|
+
|
|
8
|
+
const ALIGN_TITLE: Record<AlignType, string> = {
|
|
9
|
+
left: 'text-left',
|
|
10
|
+
center: 'text-center',
|
|
11
|
+
right: 'text-right',
|
|
12
|
+
};
|
|
6
13
|
|
|
7
14
|
export interface AccordionProps extends AccordionContent, UniBlockProps {}
|
|
8
15
|
|
|
9
16
|
export const Accordion = JSX<AccordionProps>(
|
|
10
|
-
({
|
|
17
|
+
({
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
accordionItems,
|
|
21
|
+
context,
|
|
22
|
+
className = '',
|
|
23
|
+
anchor = null,
|
|
24
|
+
accordionAlignTitle = 'center',
|
|
25
|
+
}) => {
|
|
11
26
|
return (
|
|
12
27
|
<section className={`p-[50px] font-sans bg-white text-primary-text ${className}`} id={anchor}>
|
|
13
|
-
{title ?
|
|
28
|
+
{title ? (
|
|
29
|
+
<Heading
|
|
30
|
+
headingType="h4"
|
|
31
|
+
className={`mb-2.5 ${ALIGN_TITLE[accordionAlignTitle]}`}
|
|
32
|
+
title={title}
|
|
33
|
+
/>
|
|
34
|
+
) : null}
|
|
14
35
|
{description ? <div className="mb-2.5 text-base">{description}</div> : null}
|
|
15
36
|
{accordionItems?.length ? (
|
|
16
37
|
<ul className="list-none m-0 p-0">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BlockDef } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
2
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
3
|
import type { Picture } from '../../model/Picture';
|
|
4
|
+
import type { AlignType } from '../../model/AlignType';
|
|
4
5
|
/**
|
|
5
6
|
* @title Элемент списка
|
|
6
7
|
*/
|
|
@@ -30,6 +31,8 @@ export interface AccordionItemCommonProps {
|
|
|
30
31
|
export interface AccordionContent {
|
|
31
32
|
/** @title Заголовок */
|
|
32
33
|
title?: string;
|
|
34
|
+
/** @title Выравнивание заголовка */
|
|
35
|
+
accordionAlignTitle?: AlignType;
|
|
33
36
|
version?: BlockVersion;
|
|
34
37
|
/** @title Список */
|
|
35
38
|
accordionItems?: AccordionItemCommonProps[];
|
|
@@ -2,16 +2,7 @@ import type { BlockVersion } from '../../model/BlockVersion';
|
|
|
2
2
|
import type { Picture } from '../../model/Picture';
|
|
3
3
|
import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
|
|
4
4
|
import type { HeadingType } from '../../ui-kit/Heading/HeadingContent';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @title Выравнивание
|
|
8
|
-
* @enumNames [
|
|
9
|
-
* "По левому краю",
|
|
10
|
-
* "По центру",
|
|
11
|
-
* "По правому краю"
|
|
12
|
-
* ]
|
|
13
|
-
*/
|
|
14
|
-
export type AlignType = 'left' | 'center' | 'right';
|
|
5
|
+
import type { AlignType } from '../../model/AlignType';
|
|
15
6
|
|
|
16
7
|
/**
|
|
17
8
|
* @title Общий компонент плиток
|
|
@@ -7,12 +7,10 @@ import type { Benefit, BenefitsBlockContent } from './BenefitsBlockContent';
|
|
|
7
7
|
export interface BenefitsBlockProps extends BenefitsBlockContent, UniBlockProps {}
|
|
8
8
|
|
|
9
9
|
export const BenefitsBlock = JSX<BenefitsBlockProps>(
|
|
10
|
-
({ className, title, benefits, anchor = null }) => {
|
|
10
|
+
({ className = '', title, benefits, anchor = null }) => {
|
|
11
11
|
return (
|
|
12
12
|
<section
|
|
13
|
-
className={`font-sans text-primary-text bg-white p-12 flex flex-col items-center ${
|
|
14
|
-
className || ''
|
|
15
|
-
}`}
|
|
13
|
+
className={`font-sans text-primary-text bg-white p-12 flex flex-col items-center ${className}`}
|
|
16
14
|
id={anchor}
|
|
17
15
|
>
|
|
18
16
|
{title ? (
|
|
@@ -29,7 +27,7 @@ export const BenefitsBlock = JSX<BenefitsBlockProps>(
|
|
|
29
27
|
const renderStep = (benefit: Benefit, i: number) => {
|
|
30
28
|
return (
|
|
31
29
|
<div key={String(i)} className="flex items-center gap-5 max-w-[500px]">
|
|
32
|
-
{benefit
|
|
30
|
+
{benefit?.icon ? (
|
|
33
31
|
<Img
|
|
34
32
|
className="h-[70px] w-[70px] min-w-[70px] min-h-[70px]"
|
|
35
33
|
image={benefit.icon}
|
|
@@ -38,10 +36,10 @@ const renderStep = (benefit: Benefit, i: number) => {
|
|
|
38
36
|
/>
|
|
39
37
|
) : null}
|
|
40
38
|
<div>
|
|
41
|
-
<h3 className="font-medium text-xl m-0">{benefit.label}</h3>
|
|
42
|
-
{benefit
|
|
39
|
+
{benefit?.label ? <h3 className="font-medium text-xl m-0">{benefit.label}</h3> : null}
|
|
40
|
+
{benefit?.description ? (
|
|
43
41
|
<div className="font-normal text-sm mt-2">{benefit.description}</div>
|
|
44
|
-
)}
|
|
42
|
+
) : null}
|
|
45
43
|
</div>
|
|
46
44
|
</div>
|
|
47
45
|
);
|
|
@@ -22,6 +22,7 @@ import type { StepsBlockContent } from './StepsBlock/StepsBlockContent';
|
|
|
22
22
|
import type { TariffsTableContent } from './TariffsTable/TariffsTableContent';
|
|
23
23
|
import type { TextBlockContent } from './TextBlock/TextBlockContent';
|
|
24
24
|
import type { TileContent } from './Tile/TileContent';
|
|
25
|
+
import type { BonusBenefitsBlockContent } from './BonusBenefitsBlock/BonusBenefitsBlockContent';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* @hidden
|
|
@@ -50,4 +51,5 @@ export type BlockContent =
|
|
|
50
51
|
| TileContent
|
|
51
52
|
| NavigationContent
|
|
52
53
|
| LinkListContent
|
|
53
|
-
| GroupBlockContent
|
|
54
|
+
| GroupBlockContent
|
|
55
|
+
| BonusBenefitsBlockContent;
|
package/src/components/Blocks.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { TariffsTable } from './TariffsTable/TariffsTable';
|
|
|
29
29
|
import { TextBlock } from './TextBlock/TextBlock';
|
|
30
30
|
import { Tile } from './Tile/Tile';
|
|
31
31
|
import { GroupBlock } from './GroupBlock/GroupBlock';
|
|
32
|
+
import { BonusBenefitsBlock } from './BonusBenefitsBlock/BonusBenefitsBlock';
|
|
32
33
|
|
|
33
34
|
export const Blocks = {
|
|
34
35
|
Accordion,
|
|
@@ -62,4 +63,5 @@ export const Blocks = {
|
|
|
62
63
|
Navigation,
|
|
63
64
|
Placeholder,
|
|
64
65
|
GroupBlock,
|
|
66
|
+
BonusBenefitsBlock,
|
|
65
67
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Вы можете оплатить бонусными баллами",
|
|
3
|
+
"subtitle": "Удобный каталог с большим ассортиментом товаров и сервисов",
|
|
4
|
+
"bonusBenefits": [
|
|
5
|
+
{
|
|
6
|
+
"label": "Более 5000 товаров",
|
|
7
|
+
"icon": {
|
|
8
|
+
"icon": "WateringCan"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"label": "750 авиакомпаний, 1,2 млн отелей, билеты РЖД",
|
|
13
|
+
"icon": {
|
|
14
|
+
"icon": "SignDocsIcon"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"label": "Аренда автомобилей",
|
|
19
|
+
"icon": {
|
|
20
|
+
"icon": "SignDocsIcon"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"label": "Болеее 1000 развлечений",
|
|
25
|
+
"icon": {
|
|
26
|
+
"icon": "SignDocsIcon"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "Платежные гаджеты Pay Ring",
|
|
31
|
+
"icon": {
|
|
32
|
+
"icon": "SignDocsIcon"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"label": "Цифровые сервисы",
|
|
37
|
+
"icon": {
|
|
38
|
+
"icon": "SignDocsIcon"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"label": "Фермерские продукты",
|
|
43
|
+
"icon": {
|
|
44
|
+
"icon": "SignDocsIcon"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"label": "Страхование",
|
|
49
|
+
"icon": {
|
|
50
|
+
"icon": "SignDocsIcon"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { context } from '../../setup-fixture';
|
|
2
|
+
|
|
3
|
+
import { BonusBenefitsBlock } from './BonusBenefitsBlock';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
default: (
|
|
7
|
+
<div className="container grid grid-cols-12">
|
|
8
|
+
<BonusBenefitsBlock
|
|
9
|
+
context={context}
|
|
10
|
+
className="col-span-12"
|
|
11
|
+
title="Преимущества кредита"
|
|
12
|
+
subtitle="Удобный каталог с большим ассортиментом товаров и сервисов"
|
|
13
|
+
bonusBenefits={[
|
|
14
|
+
{
|
|
15
|
+
label: 'Более 5000 товаров',
|
|
16
|
+
icon: { icon: 'WateringCan' },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: '750 авиакомпаний, 1,2 млн отелей, билеты РЖД',
|
|
20
|
+
icon: { icon: 'AirPlane' },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Аренда автомобилей',
|
|
24
|
+
icon: { icon: 'CarIcon' },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Болеее 1000 развлечений',
|
|
28
|
+
icon: { icon: 'CinemaIcon' },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Платежные гаджеты Pay Ring',
|
|
32
|
+
icon: { icon: 'SoundIcon' },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: 'Цифровые сервисы',
|
|
36
|
+
icon: { icon: 'DocsIcon' },
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Фермерские продукты',
|
|
40
|
+
icon: { icon: 'PumpkinIcon' },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'Страхование',
|
|
44
|
+
icon: { icon: 'PowerIcon' },
|
|
45
|
+
},
|
|
46
|
+
]}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
4
|
+
import { Img } from '../../ui-kit/Img/Img';
|
|
5
|
+
import type { BonusBenefit, BonusBenefitsBlockContent } from './BonusBenefitsBlockContent';
|
|
6
|
+
import { getElementsColsValue } from './getElementsColsValue';
|
|
7
|
+
|
|
8
|
+
export interface BenefitsBlockProps extends BonusBenefitsBlockContent, UniBlockProps {}
|
|
9
|
+
|
|
10
|
+
export const BonusBenefitsBlock = JSX<BenefitsBlockProps>(
|
|
11
|
+
({ className = '', title, subtitle, bonusBenefits, anchor = null }) => {
|
|
12
|
+
return (
|
|
13
|
+
<section
|
|
14
|
+
className={`font-sans text-primary-text bg-white p-50 flex flex-col ${className}`}
|
|
15
|
+
id={anchor}
|
|
16
|
+
>
|
|
17
|
+
{title ? (
|
|
18
|
+
<Heading headingType="h3" className="text-center mb-[10px]" title={title} />
|
|
19
|
+
) : null}
|
|
20
|
+
{subtitle ? <span className="text-md font-normal text-center">{subtitle}</span> : null}
|
|
21
|
+
{bonusBenefits?.length ? (
|
|
22
|
+
<div className={`grid gap-1 ${getElementsColsValue(className)}`}>
|
|
23
|
+
{bonusBenefits.map(renderBonusBenefit)}
|
|
24
|
+
</div>
|
|
25
|
+
) : null}
|
|
26
|
+
</section>
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const renderBonusBenefit = (bonusBenefit: BonusBenefit, i: number) => {
|
|
32
|
+
return (
|
|
33
|
+
<div key={String(i)} className="flex flex-col items-center max-w-[292px]">
|
|
34
|
+
{bonusBenefit?.icon ? (
|
|
35
|
+
<Img
|
|
36
|
+
className="h-[180px] w-[160px] min-w-[160px] min-h-[160px]"
|
|
37
|
+
image={bonusBenefit.icon}
|
|
38
|
+
width="160"
|
|
39
|
+
height="180"
|
|
40
|
+
/>
|
|
41
|
+
) : null}
|
|
42
|
+
<div>
|
|
43
|
+
{bonusBenefit?.label ? (
|
|
44
|
+
<span className="title-2xs text-center m-0">{bonusBenefit.label}</span>
|
|
45
|
+
) : null}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Picture } from '../../model/Picture';
|
|
2
|
+
|
|
3
|
+
export interface BonusBenefit {
|
|
4
|
+
/** @title Название */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** @title Бонус и преимущество */
|
|
7
|
+
icon?: Picture;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @title Блок бонусов и преимуществ
|
|
12
|
+
*/
|
|
13
|
+
export interface BonusBenefitsBlockContent {
|
|
14
|
+
/** @title Заголовок */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** @title Подзаголовок */
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @title Список бонусов
|
|
20
|
+
* @maxItems 8
|
|
21
|
+
*/
|
|
22
|
+
bonusBenefits?: BonusBenefit[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getColSpan } from '../../utils/getColSpan';
|
|
2
|
+
|
|
3
|
+
export function getElementsColsValue(className = '') {
|
|
4
|
+
const colSpan = getColSpan(className);
|
|
5
|
+
if (colSpan <= 6) {
|
|
6
|
+
return 'grid-cols-2';
|
|
7
|
+
} else if (colSpan <= 8) {
|
|
8
|
+
return 'grid-cols-3';
|
|
9
|
+
} else {
|
|
10
|
+
return 'grid-cols-4';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { BlockVersionWithTransparent } from '../../model/BlockVersion';
|
|
|
2
2
|
import type { DescriptionContent } from '../../ui-kit/Description/DescriptionContent';
|
|
3
3
|
import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
|
|
4
4
|
import type { ImageContent } from '../../ui-kit/Img/ImgProps';
|
|
5
|
-
import type { AlignType } from '
|
|
5
|
+
import type { AlignType } from '../../model/AlignType';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @title Заголовок
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { UniBlockProps } from '../../types';
|
|
3
3
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
4
|
-
import type { AlignType } from '
|
|
4
|
+
import type { AlignType } from '../../model/AlignType';
|
|
5
5
|
import type { LinkColumnsMode, LinkDocsContent } from './LinkDocsContent';
|
|
6
6
|
import { LinkDocsList } from './LinkDocsList';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LinkProps } from '../../model/LinkProps';
|
|
2
|
-
import type { AlignType } from '
|
|
2
|
+
import type { AlignType } from '../../model/AlignType';
|
|
3
3
|
import type { ListOrientation } from '../../model/ListOrientation';
|
|
4
4
|
import type { Picture } from '../../model/Picture';
|
|
5
5
|
|
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { VNode } from '../../model/VNode';
|
|
3
|
+
import type { ColorPalette, UniBlockProps } from '../../types';
|
|
4
|
+
import { renderBlocksList } from '../../ui-kit/BlocksList/renderBlocksList';
|
|
5
|
+
import { Foldable } from '../../ui-kit/Foldable/Foldable';
|
|
4
6
|
import type { BlockItemCommonProps } from './OtherProductsContent';
|
|
5
|
-
import { OtherProductsItemInner } from './OtherProductsItemInner';
|
|
6
|
-
import { useActiveHandler } from './useActiveHandler';
|
|
7
|
-
import { ColorPalette } from '../../types';
|
|
8
7
|
|
|
9
8
|
export interface BlockItemProps extends BlockItemCommonProps, UniBlockProps {
|
|
10
9
|
dataTheme?: ColorPalette;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export const OtherProductsItem = JSX<BlockItemProps>(
|
|
14
|
-
({ label,
|
|
15
|
-
const
|
|
13
|
+
({ label, blocks, columns = 1, context, dataTheme, isUnfolded }) => {
|
|
14
|
+
const foldableBlocks = renderBlocksList({
|
|
16
15
|
context,
|
|
16
|
+
className: 'box-border p-5',
|
|
17
|
+
columns,
|
|
17
18
|
blocks,
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
19
|
+
}) as VNode[];
|
|
21
20
|
return (
|
|
22
21
|
<div className="border-0 border-b border-solid border-main-divider">
|
|
23
|
-
{
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
blocks={
|
|
22
|
+
{blocks?.length ? (
|
|
23
|
+
<Foldable
|
|
24
|
+
foldButtonDataTheme={dataTheme}
|
|
25
|
+
hiddenBlocksNum={blocks?.length}
|
|
26
|
+
blocks={foldableBlocks}
|
|
27
|
+
isUnfolded={isUnfolded}
|
|
28
28
|
context={context}
|
|
29
|
+
foldButtonLabel={label}
|
|
30
|
+
render={(children, isActive) => (
|
|
31
|
+
<Wrapper columns={columns} isActive={isActive}>
|
|
32
|
+
{children}
|
|
33
|
+
</Wrapper>
|
|
34
|
+
)}
|
|
29
35
|
/>
|
|
30
36
|
) : null}
|
|
31
|
-
<button
|
|
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}
|
|
34
|
-
onClick={handleToggle}
|
|
35
|
-
>
|
|
36
|
-
<span className="pr-3">{isActive ? 'Скрыть' : label}</span>
|
|
37
|
-
{hasContent ? <Icon name={icon} width="20" height="20" asSVG /> : null}
|
|
38
|
-
</button>
|
|
39
37
|
</div>
|
|
40
38
|
);
|
|
41
39
|
},
|
|
42
40
|
);
|
|
41
|
+
|
|
42
|
+
const Wrapper = JSX<{ columns: number; isActive: boolean }>(({ columns, children, isActive }) => {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
className={`box-border w-full ${isActive ? 'p-9' : ''} ${
|
|
46
|
+
columns > 1 ? 'flex flex-wrap' : ''
|
|
47
|
+
}`}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
});
|