@redneckz/wildless-cms-uni-blocks 0.3.29 → 0.3.32
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/README.md +1 -1
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +70 -55
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Accordion/Accordion.js +2 -6
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/AccordionContent.d.ts +3 -3
- package/dist/components/Accordion/AccordionItem.js +4 -11
- package/dist/components/Accordion/AccordionItem.js.map +1 -1
- package/dist/components/Accordion/AccordionItem.mobile.js +6 -3
- package/dist/components/Accordion/AccordionItem.mobile.js.map +1 -1
- package/dist/components/Accordion/AccordionItemInner.js +2 -2
- package/dist/components/Accordion/AccordionItemInner.js.map +1 -1
- package/dist/components/Accordion/AccordionItemInner.mobile.js +2 -3
- package/dist/components/Accordion/AccordionItemInner.mobile.js.map +1 -1
- package/dist/components/Footer/MediaButton.js +1 -1
- package/dist/components/Footer/MediaButton.js.map +1 -1
- package/dist/components/Header/Header.js +1 -1
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MobileAppTile/MobileAppTile.js +1 -1
- package/dist/components/MobileAppTile/MobileAppTile.js.map +1 -1
- package/dist/components/OtherProducts/OtherProductsContent.d.ts +3 -12
- package/dist/components/PictureText/PictureText.js +8 -4
- package/dist/components/PictureText/PictureText.js.map +1 -1
- package/dist/components/PictureText/PictureTextContent.d.ts +7 -0
- package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
- package/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
- package/dist/components/Recommendation/Recommendation.js +1 -1
- package/dist/components/Recommendation/RecommendationCard.js +1 -1
- package/dist/components/Recommendation/RecommendationCard.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.js +8 -2
- package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.mobile.js +10 -4
- package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -2
- package/dist/components/TextBlock/TextBlockContent.d.ts +1 -1
- package/dist/ui-kit/BlocksList/EmbeddableBlocks.mobile.d.ts +8 -0
- package/dist/ui-kit/BlocksList/EmbeddableBlocks.mobile.js +17 -0
- package/dist/ui-kit/BlocksList/EmbeddableBlocks.mobile.js.map +1 -0
- package/dist/ui-kit/BlocksList/renderBlocksList.d.ts +2 -4
- package/dist/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/dist/ui-kit/Button/ButtonInner.js +1 -1
- package/dist/ui-kit/Button/ButtonInner.js.map +1 -1
- package/dist/ui-kit/Heading/Heading.js +1 -1
- package/dist/ui-kit/Heading/Heading.js.map +1 -1
- package/dist/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
- package/dist/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
- package/dist/ui-kit/SwipeListControl/utils/getScrollPoints.js +7 -1
- package/dist/ui-kit/SwipeListControl/utils/getScrollPoints.js.map +1 -1
- package/dist/ui-kit/Tabs/Tabs.js +1 -1
- package/dist/ui-kit/Tabs/Tabs.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Accordion/Accordion.js +2 -6
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/AccordionContent.d.ts +3 -3
- package/lib/components/Accordion/AccordionItem.js +4 -11
- package/lib/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/components/Accordion/AccordionItem.mobile.js +6 -3
- package/lib/components/Accordion/AccordionItem.mobile.js.map +1 -1
- package/lib/components/Accordion/AccordionItemInner.js +2 -2
- package/lib/components/Accordion/AccordionItemInner.js.map +1 -1
- package/lib/components/Accordion/AccordionItemInner.mobile.js +2 -3
- package/lib/components/Accordion/AccordionItemInner.mobile.js.map +1 -1
- package/lib/components/Footer/MediaButton.js +1 -1
- package/lib/components/Footer/MediaButton.js.map +1 -1
- package/lib/components/Header/Header.js +1 -1
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/MobileAppTile/MobileAppTile.js +1 -1
- package/lib/components/MobileAppTile/MobileAppTile.js.map +1 -1
- package/lib/components/OtherProducts/OtherProductsContent.d.ts +3 -12
- package/lib/components/PictureText/PictureText.js +8 -4
- package/lib/components/PictureText/PictureText.js.map +1 -1
- package/lib/components/PictureText/PictureTextContent.d.ts +7 -0
- package/lib/components/ProductGalleryGreen/ProductGalleryGreen.fixture.d.ts +1 -0
- package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
- package/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
- package/lib/components/Recommendation/Recommendation.js +1 -1
- package/lib/components/Recommendation/RecommendationCard.js +1 -1
- package/lib/components/Recommendation/RecommendationCard.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.fixture.d.ts +1 -0
- package/lib/components/StepsBlock/StepsBlock.js +8 -2
- package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.mobile.js +10 -4
- package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -2
- package/lib/components/TextBlock/TextBlockContent.d.ts +1 -1
- package/lib/ui-kit/BlocksList/EmbeddableBlocks.mobile.d.ts +8 -0
- package/lib/ui-kit/BlocksList/EmbeddableBlocks.mobile.js +15 -0
- package/lib/ui-kit/BlocksList/EmbeddableBlocks.mobile.js.map +1 -0
- package/lib/ui-kit/BlocksList/renderBlocksList.d.ts +2 -4
- package/lib/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/lib/ui-kit/Button/ButtonInner.js +1 -1
- package/lib/ui-kit/Button/ButtonInner.js.map +1 -1
- package/lib/ui-kit/Heading/Heading.js +1 -1
- package/lib/ui-kit/Heading/Heading.js.map +1 -1
- package/lib/ui-kit/SwipeListControl/SwipeListControl.fixture.mobile.d.ts +3 -0
- package/lib/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
- package/lib/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
- package/lib/ui-kit/SwipeListControl/utils/getScrollPoints.d.ts +4 -1
- package/lib/ui-kit/SwipeListControl/utils/getScrollPoints.js +7 -1
- package/lib/ui-kit/SwipeListControl/utils/getScrollPoints.js.map +1 -1
- package/lib/ui-kit/Tabs/Tabs.js +1 -1
- package/lib/ui-kit/Tabs/Tabs.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +87 -189
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Accordion/AccordionContent.d.ts +3 -3
- package/mobile/dist/components/Accordion/AccordionItem.js +6 -3
- package/mobile/dist/components/Accordion/AccordionItem.js.map +1 -1
- package/mobile/dist/components/Accordion/AccordionItemInner.js +2 -3
- package/mobile/dist/components/Accordion/AccordionItemInner.js.map +1 -1
- package/mobile/dist/components/Footer/MediaButton.js +1 -1
- package/mobile/dist/components/Footer/MediaButton.js.map +1 -1
- package/mobile/dist/components/OtherProducts/OtherProductsContent.d.ts +3 -12
- package/mobile/dist/components/PictureText/PictureText.js +8 -4
- package/mobile/dist/components/PictureText/PictureText.js.map +1 -1
- package/mobile/dist/components/PictureText/PictureTextContent.d.ts +7 -0
- package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
- package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/mobile/dist/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
- package/mobile/dist/components/Recommendation/Recommendation.js +1 -1
- package/mobile/dist/components/Recommendation/RecommendationCard.js +1 -1
- package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -1
- package/mobile/dist/components/StepsBlock/StepsBlock.js +10 -4
- package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +3 -2
- package/mobile/dist/components/TextBlock/TextBlockContent.d.ts +1 -1
- package/mobile/dist/ui-kit/BlocksList/EmbeddableBlocks.d.ts +0 -4
- package/mobile/dist/ui-kit/BlocksList/EmbeddableBlocks.js +0 -8
- package/mobile/dist/ui-kit/BlocksList/EmbeddableBlocks.js.map +1 -1
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.d.ts +2 -4
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/mobile/dist/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/mobile/dist/ui-kit/Button/ButtonInner.js +1 -1
- package/mobile/dist/ui-kit/Button/ButtonInner.js.map +1 -1
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
- package/mobile/dist/ui-kit/SwipeListControl/utils/getScrollPoints.js +7 -1
- package/mobile/dist/ui-kit/SwipeListControl/utils/getScrollPoints.js.map +1 -1
- package/mobile/dist/ui-kit/Tabs/Tabs.js +1 -1
- package/mobile/dist/ui-kit/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/components/Accordion/AccordionContent.d.ts +3 -3
- package/mobile/lib/components/Accordion/AccordionItem.js +6 -3
- package/mobile/lib/components/Accordion/AccordionItem.js.map +1 -1
- package/mobile/lib/components/Accordion/AccordionItemInner.js +2 -3
- package/mobile/lib/components/Accordion/AccordionItemInner.js.map +1 -1
- package/mobile/lib/components/Footer/MediaButton.js +1 -1
- package/mobile/lib/components/Footer/MediaButton.js.map +1 -1
- package/mobile/lib/components/OtherProducts/OtherProductsContent.d.ts +3 -12
- package/mobile/lib/components/PictureText/PictureText.js +8 -4
- package/mobile/lib/components/PictureText/PictureText.js.map +1 -1
- package/mobile/lib/components/PictureText/PictureTextContent.d.ts +7 -0
- package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js +31 -15
- package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreen.js.map +1 -1
- package/mobile/lib/components/ProductGalleryGreen/ProductGalleryGreenContent.d.ts +2 -0
- package/mobile/lib/components/Recommendation/Recommendation.js +1 -1
- package/mobile/lib/components/Recommendation/RecommendationCard.js +1 -1
- package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlock.js +10 -4
- package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +3 -2
- package/mobile/lib/components/TextBlock/TextBlockContent.d.ts +1 -1
- package/mobile/lib/ui-kit/BlocksList/EmbeddableBlocks.d.ts +0 -4
- package/mobile/lib/ui-kit/BlocksList/EmbeddableBlocks.js +0 -8
- package/mobile/lib/ui-kit/BlocksList/EmbeddableBlocks.js.map +1 -1
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.d.ts +2 -4
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js +3 -3
- package/mobile/lib/ui-kit/BlocksList/renderBlocksList.js.map +1 -1
- package/mobile/lib/ui-kit/Button/ButtonInner.js +1 -1
- package/mobile/lib/ui-kit/Button/ButtonInner.js.map +1 -1
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListControlDots.js +1 -1
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListControlDots.js.map +1 -1
- package/mobile/lib/ui-kit/SwipeListControl/utils/getScrollPoints.js +7 -1
- package/mobile/lib/ui-kit/SwipeListControl/utils/getScrollPoints.js.map +1 -1
- package/mobile/lib/ui-kit/Tabs/Tabs.js +1 -1
- package/mobile/lib/ui-kit/Tabs/Tabs.js.map +1 -1
- package/mobile/src/components/Accordion/Accordion.example.json +3 -0
- package/mobile/src/components/Accordion/AccordionContent.ts +4 -5
- package/mobile/src/components/Accordion/AccordionItem.tsx +32 -27
- package/mobile/src/components/Accordion/AccordionItemInner.tsx +8 -11
- package/mobile/src/components/Footer/MediaButton.tsx +1 -1
- package/mobile/src/components/Header/Header.example.json +3 -0
- package/mobile/src/components/OtherProducts/OtherProductsContent.ts +3 -12
- package/mobile/src/components/PictureText/PictureText.example.json +2 -0
- package/mobile/src/components/PictureText/PictureText.tsx +33 -7
- package/mobile/src/components/PictureText/PictureTextContent.ts +7 -0
- package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +2 -1
- package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +40 -17
- package/mobile/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +2 -0
- package/mobile/src/components/Recommendation/Recommendation.tsx +1 -1
- package/mobile/src/components/Recommendation/RecommendationCard.tsx +1 -1
- package/mobile/src/components/StepsBlock/StepsBlock.tsx +14 -5
- package/mobile/src/components/StepsBlock/StepsBlockContent.ts +3 -2
- package/mobile/src/components/TextBlock/TextBlockContent.ts +1 -1
- package/mobile/src/ui-kit/BlocksList/EmbeddableBlocks.tsx +0 -8
- package/mobile/src/ui-kit/BlocksList/renderBlocksList.tsx +4 -12
- package/mobile/src/ui-kit/Button/ButtonInner.tsx +2 -2
- package/mobile/src/ui-kit/SwipeListControl/SwipeListControlDots.tsx +1 -1
- package/mobile/src/ui-kit/SwipeListControl/utils/getScrollPoints.spec.ts +18 -0
- package/mobile/src/ui-kit/SwipeListControl/utils/getScrollPoints.ts +10 -2
- package/mobile/src/ui-kit/Tabs/Tabs.tsx +1 -1
- package/package.json +2 -3
- package/src/components/Accordion/Accordion.example.json +3 -0
- package/src/components/Accordion/Accordion.fixture.mobile.tsx +1 -0
- package/src/components/Accordion/Accordion.fixture.tsx +2 -0
- package/src/components/Accordion/Accordion.tsx +4 -17
- package/src/components/Accordion/AccordionContent.ts +4 -5
- package/src/components/Accordion/AccordionItem.mobile.tsx +32 -27
- package/src/components/Accordion/AccordionItem.tsx +23 -49
- package/src/components/Accordion/AccordionItemInner.mobile.tsx +8 -11
- package/src/components/Accordion/AccordionItemInner.tsx +8 -10
- package/src/components/Footer/MediaButton.tsx +1 -1
- package/src/components/Header/Header.example.json +3 -0
- package/src/components/Header/Header.tsx +8 -1
- package/src/components/MobileAppTile/MobileAppTile.tsx +3 -3
- package/src/components/OtherProducts/OtherProducts.fixture.tsx +61 -6
- package/src/components/OtherProducts/OtherProductsContent.ts +3 -12
- package/src/components/PictureText/PictureText.example.json +2 -0
- package/src/components/PictureText/PictureText.tsx +33 -7
- package/src/components/PictureText/PictureTextContent.ts +7 -0
- package/src/components/ProductGalleryGreen/ProductGalleryGreen.example.json +2 -1
- package/src/components/ProductGalleryGreen/ProductGalleryGreen.fixture.tsx +74 -1
- package/src/components/ProductGalleryGreen/ProductGalleryGreen.tsx +40 -17
- package/src/components/ProductGalleryGreen/ProductGalleryGreenContent.ts +2 -0
- package/src/components/Recommendation/Recommendation.tsx +1 -1
- package/src/components/Recommendation/RecommendationCard.tsx +1 -1
- package/src/components/StepsBlock/StepsBlock.fixture.tsx +14 -0
- package/src/components/StepsBlock/StepsBlock.mobile.tsx +14 -5
- package/src/components/StepsBlock/StepsBlock.tsx +13 -6
- package/src/components/StepsBlock/StepsBlockContent.ts +3 -2
- package/src/components/TextBlock/TextBlockContent.ts +1 -1
- package/src/ui-kit/BlocksList/EmbeddableBlocks.mobile.tsx +15 -0
- package/src/ui-kit/BlocksList/renderBlocksList.tsx +4 -12
- package/src/ui-kit/Button/ButtonInner.tsx +2 -2
- package/src/ui-kit/Heading/Heading.tsx +1 -3
- package/src/ui-kit/SwipeListControl/SwipeListControl.fixture.mobile.tsx +24 -6
- package/src/ui-kit/SwipeListControl/SwipeListControlDots.tsx +1 -1
- package/src/ui-kit/SwipeListControl/utils/getScrollPoints.spec.ts +18 -0
- package/src/ui-kit/SwipeListControl/utils/getScrollPoints.ts +10 -2
- package/src/ui-kit/Tabs/Tabs.tsx +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlockVersion } from '../../model/BlockVersion';
|
|
1
2
|
import type { HeadingContent } from '../../ui-kit/Heading/HeadingContent';
|
|
2
3
|
import type { ImageContent } from '../../ui-kit/Img/ImgProps';
|
|
3
4
|
import type { Benefit } from '../BenefitsBlock/BenefitsBlockContent';
|
|
@@ -8,6 +9,12 @@ export type TitleWithImageContent = HeadingContent & ImageContent;
|
|
|
8
9
|
* @title Картинка с текстом
|
|
9
10
|
*/
|
|
10
11
|
export interface PictureTextContent extends TitleWithImageContent {
|
|
12
|
+
version?: BlockVersion;
|
|
11
13
|
/** @title Список преимуществ */
|
|
12
14
|
benefits?: Benefit[];
|
|
15
|
+
/**
|
|
16
|
+
* @title Картинка справа/текст слева
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
directionRight?: boolean;
|
|
13
20
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { UniBlockProps } from '../../types';
|
|
3
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
4
|
import { Icon } from '../../ui-kit/Icon/Icon';
|
|
4
5
|
import type { ProductBlockInnerContent } from '../ProductBlock/ProductBlockContent';
|
|
5
6
|
import { ProductBlockInner } from '../ProductBlock/ProductBlockInner';
|
|
@@ -7,23 +8,39 @@ import type { ProductGalleryGreenContent } from './ProductGalleryGreenContent';
|
|
|
7
8
|
|
|
8
9
|
export interface ProductGalleryProps extends ProductGalleryGreenContent, UniBlockProps {}
|
|
9
10
|
|
|
11
|
+
const productGalleryGreenStyleMap: Record<BlockVersion, string> = {
|
|
12
|
+
primary: 'bg-white text-primary-text',
|
|
13
|
+
secondary: 'bg-primary-main text-white',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const productBlockStyleMap: Record<BlockVersion, string> = {
|
|
17
|
+
primary: 'text-secondary-text',
|
|
18
|
+
secondary: 'text-white/80',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const productSlideStyleMap: Record<BlockVersion, string> = {
|
|
22
|
+
primary: 'bg-white text-primary-text',
|
|
23
|
+
secondary: 'bg-primary-main text-white',
|
|
24
|
+
};
|
|
25
|
+
|
|
10
26
|
export const ProductGalleryGreen = JSX<ProductGalleryProps>(
|
|
11
|
-
({ className = '', context, slides = [], anchor = null }) => {
|
|
27
|
+
({ className = '', context, slides = [], version = 'primary', duration = 0, anchor = null }) => {
|
|
12
28
|
const galleryNav = slides.map((s) => s.nav);
|
|
13
29
|
const galleryBlocks = slides.map((s) => s.productBlock);
|
|
14
30
|
const [activeSlideIndex, setActiveSlideIndex] = context.useState(0);
|
|
15
31
|
|
|
16
32
|
return (
|
|
17
33
|
<section
|
|
18
|
-
className={`box-border pt-[70px] relative font-sans overflow-hidden bg-primary-main w-100 ${className}`}
|
|
19
34
|
id={anchor}
|
|
35
|
+
className={`box-border pt-[70px] overflow-hidden relative font-sans w-100 ${className}
|
|
36
|
+
${productGalleryGreenStyleMap[version]}`}
|
|
20
37
|
>
|
|
21
38
|
<div
|
|
22
39
|
className="flex duration-1000 pb-14"
|
|
23
40
|
style={{ transform: `translateX(-${activeSlideIndex}00%)` }}
|
|
24
41
|
role="list"
|
|
25
42
|
>
|
|
26
|
-
{galleryBlocks.map((_, i) => renderProductBlock(_, i, context))}
|
|
43
|
+
{galleryBlocks.map((_, i) => renderProductBlock({ ..._, version }, i, context))}
|
|
27
44
|
</div>
|
|
28
45
|
|
|
29
46
|
<div className="flex items-center absolute bottom-6 left-0 right-0 px-9 box-border">
|
|
@@ -33,6 +50,8 @@ export const ProductGalleryGreen = JSX<ProductGalleryProps>(
|
|
|
33
50
|
i,
|
|
34
51
|
activeSlideIndex,
|
|
35
52
|
onClick: () => setActiveSlideIndex(i),
|
|
53
|
+
version,
|
|
54
|
+
duration,
|
|
36
55
|
}),
|
|
37
56
|
)}
|
|
38
57
|
</div>
|
|
@@ -42,6 +61,9 @@ export const ProductGalleryGreen = JSX<ProductGalleryProps>(
|
|
|
42
61
|
);
|
|
43
62
|
|
|
44
63
|
function renderProductBlock(block: ProductBlockInnerContent, i: number, context) {
|
|
64
|
+
const { version } = block;
|
|
65
|
+
const additionalClass = version ? productBlockStyleMap[version] : '';
|
|
66
|
+
|
|
45
67
|
return (
|
|
46
68
|
<section
|
|
47
69
|
key={String(i)}
|
|
@@ -55,10 +77,9 @@ function renderProductBlock(block: ProductBlockInnerContent, i: number, context)
|
|
|
55
77
|
</div>
|
|
56
78
|
) : null}
|
|
57
79
|
<ProductBlockInner
|
|
58
|
-
className=
|
|
80
|
+
className={`pl-2.5 pt-2.5 pb-1.5 pr-[6.25rem] z-[1] ${additionalClass}`}
|
|
59
81
|
context={context}
|
|
60
82
|
textBlockClassName="mb-[154px]"
|
|
61
|
-
version="secondary"
|
|
62
83
|
{...block}
|
|
63
84
|
/>
|
|
64
85
|
<Icon
|
|
@@ -72,32 +93,34 @@ function renderProductBlock(block: ProductBlockInnerContent, i: number, context)
|
|
|
72
93
|
);
|
|
73
94
|
}
|
|
74
95
|
|
|
75
|
-
function renderNavButton({ slide, i, activeSlideIndex, onClick }) {
|
|
96
|
+
function renderNavButton({ slide, i, activeSlideIndex, onClick, version, duration }) {
|
|
76
97
|
const isActiveBtn = i === activeSlideIndex;
|
|
77
98
|
const btnClassName = isActiveBtn
|
|
78
|
-
? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px] max-w-[354px] p-0'
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
: 'text-m-base text-white';
|
|
86
|
-
|
|
99
|
+
? 'bg-white shadow-dark-blue/42 h-[102px] w-[354px] min-w-[354px] max-w-[354px] p-0 border-none'
|
|
100
|
+
: `min-w-[277px] px-0 pt-4 pb-[23px] hover:py-[26px] hover:py-[26px] ease-in duration-300
|
|
101
|
+
${productSlideStyleMap[version]}`;
|
|
102
|
+
const btnTitleClassName = isActiveBtn ? 'text-primary-text' : productBlockStyleMap[version];
|
|
103
|
+
const btnDescClassName = isActiveBtn ? 'text-secondary-text' : productBlockStyleMap[version];
|
|
104
|
+
const additionalBorder = version === 'secondary' ? 'border-white/50' : '';
|
|
105
|
+
const progressBarClassName = isActiveBtn ? 'animate-slide' : '';
|
|
87
106
|
return (
|
|
88
107
|
<button
|
|
89
108
|
type="button"
|
|
90
109
|
key={String(i)}
|
|
91
110
|
onClick={onClick}
|
|
92
111
|
aria-label={slide?.title}
|
|
93
|
-
className={`box-border font-sans group relative overflow-hidden border-
|
|
94
|
-
|
|
112
|
+
className={`box-border font-sans group relative overflow-hidden border-[1px] cursor-pointer text-left mx-1 grow basis-0 backdrop-blur-sm
|
|
113
|
+
${btnClassName} ${additionalBorder}
|
|
95
114
|
`}
|
|
96
115
|
>
|
|
97
116
|
<div className="border-0 px-6">
|
|
98
117
|
<div className={`font-medium ${btnTitleClassName}`}>{slide?.title}</div>
|
|
99
118
|
<div className={`text-secondary-text ${btnDescClassName}`}>{slide.description}</div>
|
|
100
119
|
</div>
|
|
120
|
+
<div
|
|
121
|
+
className={`absolute bottom-0 left-0 w-full h-[3px] bg-primary-main -translate-x-full ${progressBarClassName}`}
|
|
122
|
+
style={{ animationDuration: `${duration}s`, animationFillMode: 'forwards' }}
|
|
123
|
+
></div>
|
|
101
124
|
</button>
|
|
102
125
|
);
|
|
103
126
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProductBlockInnerContent } from '../ProductBlock/ProductBlockContent';
|
|
2
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
3
|
|
|
3
4
|
/** @title Кнопка под слайдом */
|
|
4
5
|
interface ProductGalleryNav {
|
|
@@ -29,4 +30,5 @@ export interface ProductGalleryGreenContent {
|
|
|
29
30
|
duration?: number;
|
|
30
31
|
/** @title Слайды */
|
|
31
32
|
slides?: ProductSlide[];
|
|
33
|
+
version?: BlockVersion;
|
|
32
34
|
}
|
|
@@ -24,7 +24,7 @@ export const Recommendation = JSX<RecommendationProps>(
|
|
|
24
24
|
className={`relative font-sans p-[50px] overflow-hidden ${blockClassName} ${className}`}
|
|
25
25
|
id={anchor}
|
|
26
26
|
>
|
|
27
|
-
{title ? <Heading headingType="
|
|
27
|
+
{title ? <Heading headingType="h2" className="mb-8" title={title} /> : null}
|
|
28
28
|
<div
|
|
29
29
|
className="flex duration-1000 gap-4"
|
|
30
30
|
style={{ transform: `translateX(-${activeCardIndex * CARD_SHIFT}px)` }}
|
|
@@ -25,7 +25,7 @@ export const RecommendationCard = JSX<RecommendationCardProps>(
|
|
|
25
25
|
image={image?.src && <Img className="mt-auto ml-7" image={image} />}
|
|
26
26
|
>
|
|
27
27
|
{description ? <Description description={description} /> : null}
|
|
28
|
-
{items?.length ? <List items={items} version={version} /> : null}
|
|
28
|
+
{items?.length ? <List className="text-m-base" items={items} version={version} /> : null}
|
|
29
29
|
</BaseTile>
|
|
30
30
|
</section>
|
|
31
31
|
);
|
|
@@ -16,6 +16,16 @@ type StyleType = {
|
|
|
16
16
|
iconConnector: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const STEPS_SIZE_MAP: Record<SizeVersion, string> = {
|
|
20
|
+
normal: 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]',
|
|
21
|
+
small: 'h-[50px] w-[50px] min-w-[50px] min-h-[50px]',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const STEPS_TILE_DESCRIPTION_HEIGHT_MAP: Record<SizeVersion, string> = {
|
|
25
|
+
normal: 'min-h-[70px]',
|
|
26
|
+
small: 'min-h-[50px]',
|
|
27
|
+
};
|
|
28
|
+
|
|
19
29
|
const STEPS_BLOCK_STYLE_MAPS: Record<BlockVersion, StyleType> = {
|
|
20
30
|
primary: {
|
|
21
31
|
background: 'bg-white',
|
|
@@ -88,7 +98,9 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
|
|
|
88
98
|
<div className={`min-h-8 h-full w-[2px] ${style.iconConnector} ${margin}`} />
|
|
89
99
|
)}
|
|
90
100
|
</div>
|
|
91
|
-
<div
|
|
101
|
+
<div
|
|
102
|
+
className={`flex flex-col justify-center h-fit ${STEPS_TILE_DESCRIPTION_HEIGHT_MAP[size]}`}
|
|
103
|
+
>
|
|
92
104
|
{step.label && (
|
|
93
105
|
<div className="font-medium text-m-title-xs m-0 text-left">{step.label}</div>
|
|
94
106
|
)}
|
|
@@ -110,10 +122,7 @@ const renderStepTitle = (params: RenderStepTitleParams) => {
|
|
|
110
122
|
const renderIconArea = (params: RenderStepTitleParams) => {
|
|
111
123
|
const { step, size, i, version } = params;
|
|
112
124
|
const style = styleMaps(version);
|
|
113
|
-
const iconAreaSize =
|
|
114
|
-
size === 'normal'
|
|
115
|
-
? 'h-[70px] w-[70px] min-w-[70px] min-h-[70px]'
|
|
116
|
-
: 'h-[50px] w-[50px] min-w-[50px] min-h-[50px]';
|
|
125
|
+
const iconAreaSize = STEPS_SIZE_MAP[size];
|
|
117
126
|
|
|
118
127
|
const iconSize = size === 'normal' ? '38' : '27';
|
|
119
128
|
const iconTextSize = size === 'normal' ? 'text-m-title' : 'text-m-title-xs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IconName } from '../../
|
|
1
|
+
import type { IconName } from '../../icons/IconName';
|
|
2
2
|
import type { SizeVersion } from '../../model/SizeVersion';
|
|
3
3
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
4
4
|
|
|
@@ -26,9 +26,10 @@ export interface StepsBlockContent {
|
|
|
26
26
|
/**
|
|
27
27
|
* @title Шаги
|
|
28
28
|
* @minItems 2
|
|
29
|
-
* @maxItems
|
|
29
|
+
* @maxItems 4
|
|
30
30
|
*/
|
|
31
31
|
steps?: Step[];
|
|
32
|
+
/** @title Размер шагов (моб.) */
|
|
32
33
|
size?: SizeVersion; // TODO: mobile content
|
|
33
34
|
version?: BlockVersion; // TODO: mobile content
|
|
34
35
|
}
|
|
@@ -23,7 +23,7 @@ export interface TextBlockContent {
|
|
|
23
23
|
iconVersion?: TextBlockIconVersion;
|
|
24
24
|
image?: Picture;
|
|
25
25
|
blockVersion?: TextBlockVersion;
|
|
26
|
-
/** @title
|
|
26
|
+
/** @title Буллиты */ // TODO: mobile prop
|
|
27
27
|
isDotted?: boolean;
|
|
28
28
|
/** @title Список (моб.) */ // TODO: mobile prop
|
|
29
29
|
items?: string[];
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { Headline } from '../../components/Headline/Headline';
|
|
2
2
|
import { LinkDocs } from '../../components/LinkDocs/LinkDocs';
|
|
3
|
-
import { PictureText } from '../../components/PictureText/PictureText';
|
|
4
3
|
import { ProductBlock } from '../../components/ProductBlock/ProductBlock';
|
|
5
4
|
import { TextBlock } from '../../components/TextBlock/TextBlock';
|
|
6
|
-
import { Tile } from '../../components/Tile/Tile';
|
|
7
|
-
import { ProductTile } from '../../components/ProductTile/ProductTile';
|
|
8
5
|
import { Gallery } from '../../components/Gallery/Gallery';
|
|
9
|
-
import { MiniGallery } from '../../components/MiniGallery/MiniGallery';
|
|
10
6
|
import { LinkList } from '../../components/LinkList/LinkList';
|
|
11
7
|
|
|
12
8
|
export const EmbeddableBlocks = {
|
|
13
9
|
Headline,
|
|
14
10
|
LinkDocs,
|
|
15
11
|
TextBlock,
|
|
16
|
-
PictureText,
|
|
17
12
|
ProductBlock,
|
|
18
|
-
Tile,
|
|
19
|
-
ProductTile,
|
|
20
13
|
Gallery,
|
|
21
|
-
MiniGallery,
|
|
22
14
|
LinkList,
|
|
23
15
|
};
|
|
@@ -2,27 +2,19 @@ import type { JSXBlock } from '../../components/ContentPage/ContentPage';
|
|
|
2
2
|
import type { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
|
|
3
3
|
import type { BlockDef, ColumnsCount } from './BlocksListProps';
|
|
4
4
|
import { EmbeddableBlocks } from './EmbeddableBlocks';
|
|
5
|
-
import { BlockVersion } from '../../model/BlockVersion';
|
|
6
5
|
|
|
7
6
|
type EmbeddableBlocksProps = {
|
|
8
7
|
blocks?: BlockDef[];
|
|
9
8
|
context: ContentPageContext;
|
|
10
9
|
columns?: ColumnsCount;
|
|
11
10
|
className?: string;
|
|
12
|
-
version?: BlockVersion;
|
|
13
11
|
};
|
|
14
12
|
|
|
15
|
-
export const renderBlocksList = ({
|
|
16
|
-
blocks,
|
|
17
|
-
context,
|
|
18
|
-
className,
|
|
19
|
-
columns,
|
|
20
|
-
version,
|
|
21
|
-
}: EmbeddableBlocksProps) =>
|
|
22
|
-
blocks?.length ? blocks.map(renderBlock({ context, className, columns, version })) : null;
|
|
13
|
+
export const renderBlocksList = ({ blocks, context, className, columns }: EmbeddableBlocksProps) =>
|
|
14
|
+
blocks?.length ? blocks.map(renderBlock({ context, className, columns })) : null;
|
|
23
15
|
|
|
24
16
|
export const renderBlock =
|
|
25
|
-
({ context, columns, className
|
|
17
|
+
({ context, columns, className }: EmbeddableBlocksProps) =>
|
|
26
18
|
(block: BlockDef, i: number) => {
|
|
27
19
|
const type = block?.blockListType;
|
|
28
20
|
if (!type || !(type in EmbeddableBlocks)) {
|
|
@@ -32,7 +24,7 @@ export const renderBlock =
|
|
|
32
24
|
const EmbeddedBlock: JSXBlock = EmbeddableBlocks[type];
|
|
33
25
|
return (
|
|
34
26
|
<div className={`${className} ${columnsCountClass}`} key={`block_${i}`}>
|
|
35
|
-
<EmbeddedBlock context={context} {...block}
|
|
27
|
+
<EmbeddedBlock context={context} {...block} className="!p-0" />
|
|
36
28
|
</div>
|
|
37
29
|
);
|
|
38
30
|
};
|
|
@@ -13,8 +13,8 @@ export const ButtonInner = JSX<ButtonInnerProps>((props) => {
|
|
|
13
13
|
{appendLeft ? appendLeft : null}
|
|
14
14
|
{isWithText(props) ? (
|
|
15
15
|
<div>
|
|
16
|
-
<div className="text-m-2xs text-left">{aboveText}</div>
|
|
17
|
-
<div className="text-m-button
|
|
16
|
+
<div className="text-m-2xs font-light text-left">{aboveText}</div>
|
|
17
|
+
<div className="text-m-button text-left">{text}</div>
|
|
18
18
|
</div>
|
|
19
19
|
) : null}
|
|
20
20
|
</div>
|
|
@@ -22,7 +22,7 @@ export const SwipeListControlDots = JSX<SwipeListControlDotsProps>(
|
|
|
22
22
|
const contentContainer = (e.currentTarget as HTMLElement).parentElement
|
|
23
23
|
?.previousElementSibling;
|
|
24
24
|
|
|
25
|
-
contentContainer?.children[idx]?.scrollIntoView({ behavior: 'smooth' });
|
|
25
|
+
contentContainer?.children[idx]?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
return showDots && children?.length ? (
|
|
@@ -17,8 +17,26 @@ const scrollPoints: [number, number][] = [
|
|
|
17
17
|
[1414, 1914],
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
+
const twoItemsScrollPointsProps = {
|
|
21
|
+
gap: 14,
|
|
22
|
+
padding: 16,
|
|
23
|
+
clientWidth: 414,
|
|
24
|
+
scrollWidth: 794,
|
|
25
|
+
childElementCount: 2,
|
|
26
|
+
itemWidth: 380,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const twoItemsScrollPoints: [number, number][] = [
|
|
30
|
+
[0, 380],
|
|
31
|
+
[380, 794],
|
|
32
|
+
];
|
|
33
|
+
|
|
20
34
|
describe('getScrollPoints', () => {
|
|
21
35
|
it('should return array containing scroll breakpoints delimiting each child', () => {
|
|
22
36
|
expect(getScrollPoints(props)).toEqual(scrollPoints);
|
|
23
37
|
});
|
|
38
|
+
|
|
39
|
+
it('should correctly handle case with 2 items in container', () => {
|
|
40
|
+
expect(getScrollPoints(twoItemsScrollPointsProps)).toEqual(twoItemsScrollPoints);
|
|
41
|
+
});
|
|
24
42
|
});
|
|
@@ -16,9 +16,17 @@ export const getScrollPoints = ({
|
|
|
16
16
|
scrollWidth: number;
|
|
17
17
|
childElementCount: number;
|
|
18
18
|
itemWidth: number;
|
|
19
|
-
}) => {
|
|
20
|
-
const scrollItemWidth = itemWidth + gap;
|
|
19
|
+
}): [number, number][] => {
|
|
21
20
|
const scrollableDistance = scrollWidth - clientWidth;
|
|
21
|
+
|
|
22
|
+
if (childElementCount === 2) {
|
|
23
|
+
return [
|
|
24
|
+
[0, scrollableDistance],
|
|
25
|
+
[scrollableDistance, scrollWidth],
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const scrollItemWidth = itemWidth + gap;
|
|
22
30
|
const edgeScrollDistance = clientWidth - gap - padding;
|
|
23
31
|
|
|
24
32
|
const lastScrollableIdx = childElementCount - 2;
|
|
@@ -19,7 +19,7 @@ const renderTab =
|
|
|
19
19
|
return (
|
|
20
20
|
<div
|
|
21
21
|
key={String(index)}
|
|
22
|
-
className={`flex h-full flex-1 cursor-pointer mr-2 last:mr-0 ${
|
|
22
|
+
className={`flex h-full flex-1 cursor-pointer mr-2 last:mr-0 box-content ${
|
|
23
23
|
isActive ? ACTIVE_TAB_STYLE : TAB_STYLE
|
|
24
24
|
}`}
|
|
25
25
|
role="tab"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ЦК",
|
|
@@ -109,14 +109,13 @@
|
|
|
109
109
|
"clean:actual": "rimraf ./cypress/snapshots/actual || exit 0"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
112
|
-
"cypress": "^10.
|
|
112
|
+
"cypress": "^10.6.0",
|
|
113
113
|
"cypress-visual-regression": "^1.7.0",
|
|
114
114
|
"react": ">=16.8.0",
|
|
115
115
|
"react-dom": ">=16.8.0"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@redneckz/uni-jsx": "^0.1.6",
|
|
119
|
-
"cypress-visual-regression": "^1.7.0",
|
|
120
119
|
"glob": "^8.0.3",
|
|
121
120
|
"remark-html": "^15.0.1",
|
|
122
121
|
"remark-parse": "^10.0.1",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"accordionItems": [
|
|
4
4
|
{
|
|
5
5
|
"label": "Аккордеон 1",
|
|
6
|
+
"labelIcon": "CardIcon",
|
|
6
7
|
"blocks": [
|
|
7
8
|
{
|
|
8
9
|
"blockListType": "TextBlock",
|
|
@@ -18,6 +19,7 @@
|
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
"label": "Аккордеон 2",
|
|
22
|
+
"labelIcon": "CardIcon",
|
|
21
23
|
"blocks": [
|
|
22
24
|
{
|
|
23
25
|
"blockListType": "TextBlock",
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
"label": "Аккордеон 3",
|
|
38
|
+
"labelIcon": "CardIcon",
|
|
36
39
|
"blocks": [
|
|
37
40
|
{
|
|
38
41
|
"blockListType": "TextBlock",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
-
import { BlockVersion } from '../../model/BlockVersion';
|
|
3
2
|
import type { UniBlockProps } from '../../types';
|
|
4
3
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
5
4
|
import type { AccordionContent } from './AccordionContent';
|
|
@@ -7,28 +6,16 @@ import { AccordionItem } from './AccordionItem';
|
|
|
7
6
|
|
|
8
7
|
export interface AccordionProps extends AccordionContent, UniBlockProps {}
|
|
9
8
|
|
|
10
|
-
const accordionStyleMap: Record<BlockVersion, string> = {
|
|
11
|
-
primary: 'bg-white text-primary-text',
|
|
12
|
-
secondary: 'bg-primary-main text-white',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
9
|
export const Accordion = JSX<AccordionProps>(
|
|
16
|
-
({ title, accordionItems, context, className = '',
|
|
10
|
+
({ title, description, accordionItems, context, className = '', anchor = null }) => {
|
|
17
11
|
return (
|
|
18
|
-
<section
|
|
19
|
-
className={`p-[50px] font-sans ${className} ${accordionStyleMap[version]}`}
|
|
20
|
-
id={anchor}
|
|
21
|
-
>
|
|
12
|
+
<section className={`p-[50px] font-sans bg-white text-primary-text ${className}`} id={anchor}>
|
|
22
13
|
{title ? <Heading headingType="h4" className="mb-2.5" title={title} /> : null}
|
|
14
|
+
{description ? <div className="mb-2.5 text-base">{description}</div> : null}
|
|
23
15
|
{accordionItems?.length ? (
|
|
24
16
|
<ul className="list-none m-0 p-0">
|
|
25
17
|
{accordionItems.map((item, i) => (
|
|
26
|
-
<AccordionItem
|
|
27
|
-
key={`AccordionItem${i}`}
|
|
28
|
-
{...item}
|
|
29
|
-
version={version}
|
|
30
|
-
context={context}
|
|
31
|
-
/>
|
|
18
|
+
<AccordionItem key={`AccordionItem${i}`} {...item} context={context} />
|
|
32
19
|
))}
|
|
33
20
|
</ul>
|
|
34
21
|
) : null}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { BlockDef
|
|
1
|
+
import type { BlockDef } from '../../ui-kit/BlocksList/BlocksListProps';
|
|
2
2
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
|
+
import type { IconName } from '../../icons/IconName';
|
|
3
4
|
/**
|
|
4
5
|
* @title Элемент списка
|
|
5
6
|
*/
|
|
@@ -20,9 +21,7 @@ export interface AccordionItemCommonProps {
|
|
|
20
21
|
* @default false
|
|
21
22
|
*/
|
|
22
23
|
bordered?: boolean; // TODO: только для мобильной версии
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
columns?: ColumnsCount;
|
|
24
|
+
labelIcon?: IconName; // TODO: только для мобильной версии
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
@@ -35,7 +34,7 @@ export interface AccordionContent {
|
|
|
35
34
|
/** @title Список */
|
|
36
35
|
accordionItems?: AccordionItemCommonProps[];
|
|
37
36
|
/** @title Описание */
|
|
38
|
-
description?: string;
|
|
37
|
+
description?: string;
|
|
39
38
|
/**
|
|
40
39
|
* @title Отображать/скрывать обводку у элемента списка
|
|
41
40
|
* @default false
|
|
@@ -7,34 +7,39 @@ import { useActiveHandler } from './useActiveHandler';
|
|
|
7
7
|
|
|
8
8
|
export interface AccordionItemProps extends AccordionItemCommonProps, UniBlockProps {}
|
|
9
9
|
|
|
10
|
-
export const AccordionItem = JSX<AccordionItemProps>(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
export const AccordionItem = JSX<AccordionItemProps>(
|
|
11
|
+
({ label, labelIcon, blocks, bordered, context }) => {
|
|
12
|
+
const { hasContent, icon, handleToggle } = useActiveHandler({
|
|
13
|
+
context,
|
|
14
|
+
blocks,
|
|
15
|
+
});
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} border-solid border-main-divider`}
|
|
21
|
-
>
|
|
22
|
-
<button
|
|
23
|
-
className={`border-none bg-transparent flex justify-between text-left w-full font-sans text-primary-text
|
|
17
|
+
return (
|
|
18
|
+
<li className={`${borderedLiClass(bordered)} border-solid border-main-divider`}>
|
|
19
|
+
<button
|
|
20
|
+
className={`border-none bg-transparent flex justify-between text-left w-full font-sans text-primary-text
|
|
24
21
|
${bordered ? '' : 'py-[14px] px-0'}
|
|
25
22
|
${hasContent ? 'group cursor-pointer' : ''}`}
|
|
26
|
-
|
|
27
|
-
>
|
|
28
|
-
<span
|
|
29
|
-
className={`text-m-title-xs pr-2.5 font-medium ${
|
|
30
|
-
hasContent ? 'group-hover:text-primary-main' : ''
|
|
31
|
-
}`}
|
|
23
|
+
onClick={handleToggle}
|
|
32
24
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
25
|
+
<span
|
|
26
|
+
className={`text-m-title-xs pr-2.5 font-medium flex ${
|
|
27
|
+
hasContent ? 'group-hover:text-primary-main' : ''
|
|
28
|
+
}`}
|
|
29
|
+
>
|
|
30
|
+
{labelIcon ? (
|
|
31
|
+
<Icon name={labelIcon} width="24" height="24" asSVG className="mr-3" />
|
|
32
|
+
) : null}
|
|
33
|
+
{label}
|
|
34
|
+
</span>
|
|
35
|
+
{hasContent ? <Icon name={icon} width="24" height="24" asSVG /> : null}
|
|
36
|
+
</button>
|
|
37
|
+
{hasContent ? <AccordionItemInner blocks={blocks} context={context} /> : null}
|
|
38
|
+
</li>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
function borderedLiClass(bordered) {
|
|
44
|
+
return bordered ? 'border p-4 rounded mb-4' : 'border-0 border-b last:border-b-0';
|
|
45
|
+
}
|