@redneckz/wildless-cms-uni-blocks 0.8.1 → 0.8.3
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 +114 -35
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Carousel/CarouselContent.d.ts +6 -1
- package/bundle/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/bundle/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/bundle/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/bundle/components/Footer/MediaButton.d.ts +2 -2
- package/bundle/components/Footer/SocialMedia.d.ts +2 -2
- package/bundle/hooks/useLink.d.ts +1 -1
- package/bundle/services/sitemap/isHrefActive.d.ts +2 -1
- package/bundle/services/sitemap/isTopItemActive.d.ts +2 -3
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/Carousel/Carousel.js +27 -6
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Carousel/CarouselContent.d.ts +6 -1
- package/dist/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/dist/components/Carousel/CarouselScrollButtons.js +35 -0
- package/dist/components/Carousel/CarouselScrollButtons.js.map +1 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js +46 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js.map +1 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js +2 -0
- package/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js.map +1 -0
- package/dist/components/CarouselCard/CarouselCard.js +1 -1
- package/dist/components/CarouselCard/CarouselCard.js.map +1 -1
- package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
- package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/dist/components/Footer/MediaButton.d.ts +2 -2
- package/dist/components/Footer/SocialMedia.d.ts +2 -2
- package/dist/components/Footer/SocialMedia.js +2 -1
- package/dist/components/Footer/SocialMedia.js.map +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/hooks/useLink.d.ts +1 -1
- package/dist/hooks/useLink.js +2 -2
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/services/sitemap/findActiveSubItem.js +2 -2
- package/dist/services/sitemap/findActiveSubItem.js.map +1 -1
- package/dist/services/sitemap/isHrefActive.d.ts +2 -1
- package/dist/services/sitemap/isHrefActive.js +1 -2
- package/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/dist/services/sitemap/isTopItemActive.d.ts +2 -3
- package/dist/services/sitemap/isTopItemActive.js +1 -2
- package/dist/services/sitemap/isTopItemActive.js.map +1 -1
- package/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/dist/ui-kit/TopItem/TopItem.js +1 -1
- package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
- package/dist/utils/url.js +1 -7
- package/dist/utils/url.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/Carousel/Carousel.fixture.d.ts +1 -0
- package/lib/components/Carousel/Carousel.js +28 -7
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/Carousel/CarouselContent.d.ts +6 -1
- package/lib/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/lib/components/Carousel/CarouselScrollButtons.js +33 -0
- package/lib/components/Carousel/CarouselScrollButtons.js.map +1 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.fixture.d.ts +15 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js +44 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js.map +1 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js +2 -0
- package/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js.map +1 -0
- package/lib/components/CarouselCard/CarouselCard.js +1 -1
- package/lib/components/CarouselCard/CarouselCard.js.map +1 -1
- package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
- package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/lib/components/Footer/MediaButton.d.ts +2 -2
- package/lib/components/Footer/SocialMedia.d.ts +2 -2
- package/lib/components/Footer/SocialMedia.js +2 -1
- package/lib/components/Footer/SocialMedia.js.map +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/hooks/useLink.d.ts +1 -1
- package/lib/hooks/useLink.js +2 -2
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/services/sitemap/findActiveSubItem.js +2 -2
- package/lib/services/sitemap/findActiveSubItem.js.map +1 -1
- package/lib/services/sitemap/isHrefActive.d.ts +2 -1
- package/lib/services/sitemap/isHrefActive.js +2 -3
- package/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/lib/services/sitemap/isTopItemActive.d.ts +2 -3
- package/lib/services/sitemap/isTopItemActive.js +1 -2
- package/lib/services/sitemap/isTopItemActive.js.map +1 -1
- package/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/lib/ui-kit/TopItem/TopItem.js +1 -1
- package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
- package/lib/utils/url.js +1 -7
- package/lib/utils/url.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +15 -24
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Carousel/CarouselContent.d.ts +6 -1
- package/mobile/bundle/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/mobile/bundle/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/mobile/bundle/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/mobile/bundle/components/Footer/MediaButton.d.ts +2 -2
- package/mobile/bundle/hooks/useLink.d.ts +1 -1
- package/mobile/bundle/services/sitemap/isHrefActive.d.ts +2 -1
- package/mobile/bundle/services/sitemap/isTopItemActive.d.ts +2 -3
- package/mobile/dist/components/Carousel/Carousel.js +27 -6
- package/mobile/dist/components/Carousel/Carousel.js.map +1 -1
- package/mobile/dist/components/Carousel/CarouselContent.d.ts +6 -1
- package/mobile/dist/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/mobile/dist/components/Carousel/CarouselScrollButtons.js +35 -0
- package/mobile/dist/components/Carousel/CarouselScrollButtons.js.map +1 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js +46 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js.map +1 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js +2 -0
- package/mobile/dist/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js.map +1 -0
- package/mobile/dist/components/CarouselCard/CarouselCard.js +1 -1
- package/mobile/dist/components/CarouselCard/CarouselCard.js.map +1 -1
- package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
- package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/mobile/dist/components/Footer/MediaButton.d.ts +2 -2
- package/mobile/dist/components/Tabs/Tabs.js +1 -1
- package/mobile/dist/components/Tabs/Tabs.js.map +1 -1
- package/mobile/dist/hooks/useLink.d.ts +1 -1
- package/mobile/dist/hooks/useLink.js +2 -2
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/services/sitemap/findActiveSubItem.js +2 -2
- package/mobile/dist/services/sitemap/findActiveSubItem.js.map +1 -1
- package/mobile/dist/services/sitemap/isHrefActive.d.ts +2 -1
- package/mobile/dist/services/sitemap/isHrefActive.js +1 -2
- package/mobile/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/dist/services/sitemap/isTopItemActive.d.ts +2 -3
- package/mobile/dist/services/sitemap/isTopItemActive.js +1 -2
- package/mobile/dist/services/sitemap/isTopItemActive.js.map +1 -1
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/mobile/dist/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/mobile/dist/ui-kit/TopItem/TopItem.js +1 -1
- package/mobile/dist/ui-kit/TopItem/TopItem.js.map +1 -1
- package/mobile/dist/utils/url.js +1 -7
- package/mobile/dist/utils/url.js.map +1 -1
- package/mobile/lib/components/Carousel/Carousel.js +28 -7
- package/mobile/lib/components/Carousel/Carousel.js.map +1 -1
- package/mobile/lib/components/Carousel/CarouselContent.d.ts +6 -1
- package/mobile/lib/components/Carousel/CarouselScrollButtons.d.ts +13 -0
- package/mobile/lib/components/Carousel/CarouselScrollButtons.js +33 -0
- package/mobile/lib/components/Carousel/CarouselScrollButtons.js.map +1 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.d.ts +9 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js +44 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCard.js.map +1 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.d.ts +9 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js +2 -0
- package/mobile/lib/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.js.map +1 -0
- package/mobile/lib/components/CarouselCard/CarouselCard.js +1 -1
- package/mobile/lib/components/CarouselCard/CarouselCard.js.map +1 -1
- package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
- package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +1 -1
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +0 -1
- package/mobile/lib/components/Footer/MediaButton.d.ts +2 -2
- package/mobile/lib/components/Tabs/Tabs.js +1 -1
- package/mobile/lib/components/Tabs/Tabs.js.map +1 -1
- package/mobile/lib/hooks/useLink.d.ts +1 -1
- package/mobile/lib/hooks/useLink.js +2 -2
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/services/sitemap/findActiveSubItem.js +2 -2
- package/mobile/lib/services/sitemap/findActiveSubItem.js.map +1 -1
- package/mobile/lib/services/sitemap/isHrefActive.d.ts +2 -1
- package/mobile/lib/services/sitemap/isHrefActive.js +2 -3
- package/mobile/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/lib/services/sitemap/isTopItemActive.d.ts +2 -3
- package/mobile/lib/services/sitemap/isTopItemActive.js +1 -2
- package/mobile/lib/services/sitemap/isTopItemActive.js.map +1 -1
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js +7 -5
- package/mobile/lib/ui-kit/SwipeListControl/SwipeListContainer.js.map +1 -1
- package/mobile/lib/ui-kit/TopItem/TopItem.js +1 -1
- package/mobile/lib/ui-kit/TopItem/TopItem.js.map +1 -1
- package/mobile/lib/utils/url.js +1 -7
- package/mobile/lib/utils/url.js.map +1 -1
- package/mobile/src/common.css +17 -0
- package/mobile/src/components/Carousel/Carousel.tsx +43 -32
- package/mobile/src/components/Carousel/CarouselContent.ts +6 -1
- package/mobile/src/components/Carousel/CarouselScrollButtons.tsx +81 -0
- package/mobile/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.example.json +4 -0
- package/mobile/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.tsx +85 -0
- package/mobile/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.ui.json +1 -0
- package/mobile/src/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.ts +9 -0
- package/mobile/src/components/CarouselCard/CarouselCard.tsx +2 -2
- package/mobile/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +1 -1
- package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +1 -1
- package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +10 -9
- package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +0 -1
- package/mobile/src/components/Footer/MediaButton.tsx +2 -2
- package/mobile/src/components/Tabs/Tabs.tsx +2 -2
- package/mobile/src/hooks/useLink.ts +4 -4
- package/mobile/src/services/sitemap/findActiveSubItem.ts +2 -2
- package/mobile/src/services/sitemap/isHrefActive.ts +6 -6
- package/mobile/src/services/sitemap/isTopItemActive.ts +3 -3
- package/mobile/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
- package/mobile/src/ui-kit/TopItem/TopItem.tsx +1 -1
- package/mobile/src/utils/url.ts +1 -9
- package/package.json +3 -3
- package/src/common.css +17 -0
- package/src/components/Blocks.ts +2 -0
- package/src/components/Carousel/Carousel.fixture.tsx +20 -0
- package/src/components/Carousel/Carousel.tsx +43 -32
- package/src/components/Carousel/CarouselContent.ts +6 -1
- package/src/components/Carousel/CarouselScrollButtons.tsx +81 -0
- package/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.example.json +4 -0
- package/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.fixture.tsx +19 -0
- package/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.tsx +85 -0
- package/src/components/CarouselBankHistoryCard/CarouselBankHistoryCard.ui.json +1 -0
- package/src/components/CarouselBankHistoryCard/CarouselBankHistoryCardContent.ts +9 -0
- package/src/components/CarouselCard/CarouselCard.tsx +2 -2
- package/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +1 -1
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +1 -1
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +10 -9
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +0 -1
- package/src/components/Footer/MediaButton.tsx +2 -2
- package/src/components/Footer/SocialMedia.tsx +6 -3
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/hooks/useLink.ts +4 -4
- package/src/services/sitemap/findActiveSubItem.ts +2 -2
- package/src/services/sitemap/isHrefActive.ts +6 -6
- package/src/services/sitemap/isTopItemActive.ts +3 -3
- package/src/ui-kit/SwipeListControl/SwipeListContainer.tsx +9 -6
- package/src/ui-kit/TopItem/TopItem.tsx +1 -1
- package/src/utils/url.ts +1 -9
- package/tailwind.config.cjs +2 -0
- package/bundle/services/sitemap/isSubItemActive.d.ts +0 -4
- package/bundle/utils/adjustHref.d.ts +0 -1
- package/dist/services/sitemap/isSubItemActive.d.ts +0 -4
- package/dist/services/sitemap/isSubItemActive.js +0 -6
- package/dist/services/sitemap/isSubItemActive.js.map +0 -1
- package/dist/utils/adjustHref.d.ts +0 -1
- package/dist/utils/adjustHref.js +0 -9
- package/dist/utils/adjustHref.js.map +0 -1
- package/lib/services/sitemap/isSubItemActive.d.ts +0 -4
- package/lib/services/sitemap/isSubItemActive.js +0 -3
- package/lib/services/sitemap/isSubItemActive.js.map +0 -1
- package/lib/utils/adjustHref.d.ts +0 -1
- package/lib/utils/adjustHref.js +0 -6
- package/lib/utils/adjustHref.js.map +0 -1
- package/mobile/bundle/services/sitemap/isSubItemActive.d.ts +0 -4
- package/mobile/bundle/utils/adjustHref.d.ts +0 -1
- package/mobile/dist/services/sitemap/isSubItemActive.d.ts +0 -4
- package/mobile/dist/services/sitemap/isSubItemActive.js +0 -6
- package/mobile/dist/services/sitemap/isSubItemActive.js.map +0 -1
- package/mobile/dist/utils/adjustHref.d.ts +0 -1
- package/mobile/dist/utils/adjustHref.js +0 -9
- package/mobile/dist/utils/adjustHref.js.map +0 -1
- package/mobile/lib/services/sitemap/isSubItemActive.d.ts +0 -4
- package/mobile/lib/services/sitemap/isSubItemActive.js +0 -3
- package/mobile/lib/services/sitemap/isSubItemActive.js.map +0 -1
- package/mobile/lib/utils/adjustHref.d.ts +0 -1
- package/mobile/lib/utils/adjustHref.js +0 -6
- package/mobile/lib/utils/adjustHref.js.map +0 -1
- package/mobile/src/services/sitemap/isSubItemActive.ts +0 -7
- package/mobile/src/utils/adjustHref.ts +0 -7
- package/src/services/sitemap/isSubItemActive.ts +0 -7
- package/src/utils/adjustHref.ts +0 -7
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { UniBlockProps } from '../../model/JSXBlock';
|
|
3
|
+
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
|
+
import { style } from '../../utils/style';
|
|
5
|
+
import { Headline } from '../Headline/Headline';
|
|
6
|
+
import type { CarouselBankHistoryCardContent } from './CarouselBankHistoryCardContent';
|
|
7
|
+
|
|
8
|
+
interface CarouselBankHistoryCardProps extends CarouselBankHistoryCardContent, UniBlockProps {
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
orderNumber?: number;
|
|
11
|
+
blocksLength?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const CarouselBankHistoryCard = JSX<CarouselBankHistoryCardProps>(
|
|
15
|
+
({ title, description, isActive, orderNumber = 0, blocksLength = 0 }) => {
|
|
16
|
+
return (
|
|
17
|
+
<BlockWrapper className="flex h-[485px]">
|
|
18
|
+
{isActive ? (
|
|
19
|
+
<div className="relative flex items-center w-full">
|
|
20
|
+
<Headline
|
|
21
|
+
headlineVersion="S"
|
|
22
|
+
title={title}
|
|
23
|
+
description={description}
|
|
24
|
+
align="text-left"
|
|
25
|
+
className={style(
|
|
26
|
+
'absolute z-10 h-[385px] w-[440px] text-white shadow-dark-blue',
|
|
27
|
+
getActiveBlockPosition(orderNumber, blocksLength),
|
|
28
|
+
getBackgroundColor(orderNumber),
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
) : (
|
|
33
|
+
<div className="flex w-full items-center justify-center">
|
|
34
|
+
<div
|
|
35
|
+
className={style(
|
|
36
|
+
'flex justify-center items-center h-[300px] w-[340px] font-mohave text-title-large tracking-[-0.03em]',
|
|
37
|
+
getBackgroundColor(orderNumber),
|
|
38
|
+
)}
|
|
39
|
+
>
|
|
40
|
+
<span className={getTextColor(orderNumber)}>{title}</span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
</BlockWrapper>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const getBackgroundColor = (orderNumber: number) => {
|
|
50
|
+
const division = orderNumber % 3;
|
|
51
|
+
switch (division) {
|
|
52
|
+
case 0:
|
|
53
|
+
return 'bg-primary-main';
|
|
54
|
+
case 1:
|
|
55
|
+
return 'bg-green-light';
|
|
56
|
+
case 2:
|
|
57
|
+
return 'bg-yellow-light';
|
|
58
|
+
|
|
59
|
+
default:
|
|
60
|
+
return 'bg-primary-main';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getTextColor = (orderNumber: number) => {
|
|
65
|
+
const division = orderNumber % 3;
|
|
66
|
+
switch (division) {
|
|
67
|
+
case 1:
|
|
68
|
+
return 'gradient-color-text-on-yellow';
|
|
69
|
+
case 2:
|
|
70
|
+
return 'gradient-color-text-on-yellow';
|
|
71
|
+
|
|
72
|
+
default:
|
|
73
|
+
return 'gradient-color-text-on-green';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getActiveBlockPosition = (orderNumber: number, blocksLength: number) => {
|
|
78
|
+
if (orderNumber === 0) {
|
|
79
|
+
return 'left-9';
|
|
80
|
+
} else if (orderNumber === blocksLength - 1) {
|
|
81
|
+
return 'right-9';
|
|
82
|
+
} else {
|
|
83
|
+
return '-left-[25px]';
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -17,13 +17,13 @@ const CARD_WIDTH_MAP: Record<CarouselCardVersion, string> = {
|
|
|
17
17
|
export const CarouselCard = JSX<CarouselCardProps>(
|
|
18
18
|
({ className = '', button, description, title, carouselVersion = 'normal' }) => (
|
|
19
19
|
<section
|
|
20
|
-
className={`flex pb-9 pl-12 border-box ${CARD_WIDTH_MAP[carouselVersion]} ${className}`}
|
|
20
|
+
className={`flex pb-9 pl-12 border-box h-full ${CARD_WIDTH_MAP[carouselVersion]} ${className}`}
|
|
21
21
|
>
|
|
22
22
|
<div className="relative w-full">
|
|
23
23
|
<div className={`${BLOCK_CLASSES} z-10 top-9 right-12 bg-green-dark`} />
|
|
24
24
|
<div className={`${BLOCK_CLASSES} z-10 top-6 right-8 bg-green`} />
|
|
25
25
|
<div className={`${BLOCK_CLASSES} z-10 top-3 right-4 bg-green-light`} />
|
|
26
|
-
<div className="relative bg-white z-10 p-10 border border-solid border-green-light">
|
|
26
|
+
<div className="relative h-full bg-white z-10 p-10 border border-solid border-green-light">
|
|
27
27
|
<Headline
|
|
28
28
|
className="!p-0"
|
|
29
29
|
title={title}
|
|
@@ -19,7 +19,7 @@ const cardStyleMap: Record<ProductColorVersion, string> = {
|
|
|
19
19
|
export const CarouselCatalogCard = JSX<CarouselCatalogCardProps>(
|
|
20
20
|
({ className = '', title, description, image, price, button, colors, ...rest }) => (
|
|
21
21
|
<BlockWrapper
|
|
22
|
-
className={`border box-border border-gray p-7 min-w-[392px] flex flex-col justify-left ${className}`}
|
|
22
|
+
className={`border box-border border-gray p-7 min-w-[392px] h-full flex flex-col justify-left ${className}`}
|
|
23
23
|
{...rest}
|
|
24
24
|
>
|
|
25
25
|
{image?.src ? <Img className="mb-5 flex justify-center" image={image} /> : null}
|
|
@@ -36,7 +36,7 @@ export const CarouselRecommendationCard = JSX<RecommendationCardProps>(
|
|
|
36
36
|
return (
|
|
37
37
|
<BlockWrapper
|
|
38
38
|
className={style(
|
|
39
|
-
'relative p-7 min-w-[524px] text-left box-border group-data-gray:bg-main-divider/50',
|
|
39
|
+
'relative p-7 min-w-[524px] h-full text-left box-border group-data-gray:bg-main-divider/50',
|
|
40
40
|
BORDER_STYLE,
|
|
41
41
|
className,
|
|
42
42
|
)}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"content": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
"image": {
|
|
4
|
+
"ui:field": "picture"
|
|
5
|
+
},
|
|
6
|
+
"socialMedia": {
|
|
7
|
+
"items": {
|
|
8
|
+
"icon": {
|
|
9
|
+
"ui:field": "icon"
|
|
10
|
+
},
|
|
11
|
+
"iconRight": {
|
|
12
|
+
"ui:field": "icon"
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -5,7 +5,7 @@ import { style } from '../../utils/style';
|
|
|
5
5
|
import type { Picture } from '../../model/Picture';
|
|
6
6
|
import type { IconVersion } from '../../model/IconVersion';
|
|
7
7
|
import { Button } from '../../ui-kit/Button/Button';
|
|
8
|
-
import type {
|
|
8
|
+
import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
|
|
9
9
|
|
|
10
10
|
const ICONS_MAP: Array<{
|
|
11
11
|
origins: string[];
|
|
@@ -46,7 +46,7 @@ const ICONS_MAP: Array<{
|
|
|
46
46
|
|
|
47
47
|
export type ButtonSize = 'default' | 'small';
|
|
48
48
|
|
|
49
|
-
interface MediaButtonProps extends
|
|
49
|
+
interface MediaButtonProps extends ButtonWithIconProps {
|
|
50
50
|
iconVersion?: IconVersion;
|
|
51
51
|
buttonSize?: ButtonSize;
|
|
52
52
|
}
|
|
@@ -2,10 +2,10 @@ import { JSX } from '@redneckz/uni-jsx';
|
|
|
2
2
|
import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { EventBus } from '../../EventBus/EventBus';
|
|
4
4
|
import type { UniBlockProps } from '../../model/JSXBlock';
|
|
5
|
-
import type { TabData, TabsContent } from './TabsContent';
|
|
6
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
7
6
|
import { renderTab } from './renderTab';
|
|
8
7
|
import { ScrollableTabs } from './ScrollableTabs';
|
|
8
|
+
import type { TabData, TabsContent } from './TabsContent';
|
|
9
9
|
|
|
10
10
|
export interface TabActivationEvent {
|
|
11
11
|
type?: TabData['type'];
|
|
@@ -35,7 +35,7 @@ export const Tabs = JSX<TabsBlockProps>((props) => {
|
|
|
35
35
|
useEffect(
|
|
36
36
|
() =>
|
|
37
37
|
currentTab?.type === 'group'
|
|
38
|
-
? EventBus.inst.subject('tab', { label: currentTab.ref })
|
|
38
|
+
? EventBus.inst.subject('tab', { type: currentTab.type, label: currentTab.ref })
|
|
39
39
|
: undefined,
|
|
40
40
|
[currentTab],
|
|
41
41
|
);
|
|
@@ -8,15 +8,15 @@ interface ClickHandler {
|
|
|
8
8
|
onClick(ev?: { preventDefault: () => void }): void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function useLink(
|
|
12
|
-
|
|
13
|
-
) => L & ClickHandler {
|
|
11
|
+
export function useLink(
|
|
12
|
+
isRemote?: boolean,
|
|
13
|
+
): <L extends Partial<LinkProps & ClickHandler>>(props: L) => L & ClickHandler {
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const blockRouter = useBlockRouter();
|
|
16
16
|
|
|
17
17
|
const handleLocalURL =
|
|
18
18
|
(href: string | undefined, target?: Target) => (ev?: { preventDefault: () => void }) => {
|
|
19
|
-
if (!isLocalURL(href, target)) {
|
|
19
|
+
if (isRemote || !isLocalURL(href, target)) {
|
|
20
20
|
// Proceed with native handle
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Router } from '../../hooks/useRouter';
|
|
2
2
|
import type { LinkProps } from '../../model/LinkProps';
|
|
3
3
|
import { maxBy } from '../../utils/maxBy';
|
|
4
|
-
import {
|
|
4
|
+
import { isHrefActive } from './isHrefActive';
|
|
5
5
|
|
|
6
6
|
export const findActiveSubItem =
|
|
7
7
|
(router: Router) =>
|
|
8
8
|
<T extends LinkProps>(items: T[] = []): T | undefined => {
|
|
9
|
-
const possibleActiveSubItems = items?.filter(
|
|
9
|
+
const possibleActiveSubItems = items?.filter(isHrefActive(router));
|
|
10
10
|
|
|
11
11
|
return possibleActiveSubItems?.length
|
|
12
12
|
? maxBy((_: T) => _.href?.length || 0)(possibleActiveSubItems) // More specific item with max length
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Router } from '../../hooks/useRouter';
|
|
2
|
+
import { isURL, withoutQuery } from '../../utils/url';
|
|
3
3
|
|
|
4
|
-
export const isHrefActive =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export const isHrefActive =
|
|
5
|
+
(router: Router) =>
|
|
6
|
+
({ href }: { href?: string }): boolean =>
|
|
7
|
+
withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(withoutQuery(href));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { Router } from '../../hooks/useRouter';
|
|
1
2
|
import { isHrefActive } from './isHrefActive';
|
|
2
|
-
import { isSubItemActive } from './isSubItemActive';
|
|
3
3
|
import { TopMenuItem } from './SitemapProps';
|
|
4
4
|
|
|
5
5
|
export const isTopItemActive =
|
|
6
|
-
(router:
|
|
6
|
+
(router: Router) =>
|
|
7
7
|
(topItem: TopMenuItem): boolean =>
|
|
8
|
-
topItem.items?.some(
|
|
8
|
+
topItem.items?.some(isHrefActive(router)) || isHrefActive(router)(topItem);
|
|
@@ -27,6 +27,8 @@ interface SwipeListContainerProps extends SwipeContainerProps {
|
|
|
27
27
|
|
|
28
28
|
const childStyleMap = ['min-w-[100%]', 'min-w-[50%]', 'min-w-[33.33%]', 'min-w-[25%]'];
|
|
29
29
|
|
|
30
|
+
const DEFAULT_HEIGHT = '866px';
|
|
31
|
+
|
|
30
32
|
export const SwipeListContainer = JSX<SwipeListContainerProps>(
|
|
31
33
|
({
|
|
32
34
|
className = '',
|
|
@@ -65,9 +67,13 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
|
|
|
65
67
|
const isHorizontalList = listType === 'horizontal-list';
|
|
66
68
|
const containerStyle = {
|
|
67
69
|
...(isHorizontalList ? getContainerOffset(padding, additionPadding) : {}),
|
|
68
|
-
...(isVerticalList ?
|
|
70
|
+
...(isVerticalList ? { height: DEFAULT_HEIGHT } : {}),
|
|
69
71
|
gap: `${gap}px`,
|
|
70
72
|
};
|
|
73
|
+
const itemContainerStyle = {
|
|
74
|
+
...(isHorizontalList ? getContainerOffset(padding / 4) : {}),
|
|
75
|
+
maxHeight: DEFAULT_HEIGHT,
|
|
76
|
+
};
|
|
71
77
|
|
|
72
78
|
return (
|
|
73
79
|
<div
|
|
@@ -82,8 +88,9 @@ export const SwipeListContainer = JSX<SwipeListContainerProps>(
|
|
|
82
88
|
className={style(
|
|
83
89
|
snapAlign,
|
|
84
90
|
visibleItemCount ? childStyleMap[visibleItemCount - 1] : '',
|
|
91
|
+
isVerticalList ? 'h-full' : '',
|
|
85
92
|
)}
|
|
86
|
-
style={
|
|
93
|
+
style={itemContainerStyle}
|
|
87
94
|
activeIndex={activeIndex}
|
|
88
95
|
idx={idx}
|
|
89
96
|
observerOptions={observerOptions}
|
|
@@ -110,7 +117,3 @@ const getVisibleIndices = (itemsVisibilityList: ItemsVisibilityList) =>
|
|
|
110
117
|
.map((_, i): [IntersectionObserverEntry | undefined, number] => [_, i])
|
|
111
118
|
.filter(([_]) => _ && _.intersectionRatio >= 0.9)
|
|
112
119
|
.map(([, i]) => i);
|
|
113
|
-
|
|
114
|
-
const getContainerHeight = (ref?: { current: HTMLDivElement | null }) => ({
|
|
115
|
-
height: ref?.current?.firstElementChild?.clientHeight || 0,
|
|
116
|
-
});
|
|
@@ -15,7 +15,7 @@ export interface TopItemProps extends TopItemContent {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export const TopItem = JSX<TopItemProps>(({ className = '', active, flat, children, ...rest }) => {
|
|
18
|
-
const link = useLink();
|
|
18
|
+
const link = useLink(true);
|
|
19
19
|
const { href, target, text, onClick } = link(rest);
|
|
20
20
|
|
|
21
21
|
return (
|
package/mobile/src/utils/url.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { Target } from '../model/LinkProps';
|
|
2
|
-
import { projectSettings } from '../ProjectSettings';
|
|
3
2
|
|
|
4
3
|
export const isURL = (href?: string): href is `${string}//${string}` =>
|
|
5
4
|
Boolean(href?.includes('//'));
|
|
6
5
|
|
|
7
6
|
export const isLocalURL = (href: string | undefined, target?: Target) =>
|
|
8
|
-
Boolean(
|
|
9
|
-
href &&
|
|
10
|
-
!isURL(href) &&
|
|
11
|
-
(projectSettings.BASE_PATH
|
|
12
|
-
? href.startsWith(projectSettings.BASE_PATH)
|
|
13
|
-
: !href.startsWith('/')) &&
|
|
14
|
-
(!target || target === '_self'),
|
|
15
|
-
);
|
|
7
|
+
Boolean(href && !isURL(href) && (!target || target === '_self'));
|
|
16
8
|
|
|
17
9
|
export const isHash = (href?: string): href is `#${string}` => Boolean(href?.startsWith('#'));
|
|
18
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ЦК",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"react-dom": ">=16.8.0"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"@redneckz/uni-jsx": "^2.
|
|
122
|
+
"@redneckz/uni-jsx": "^2.3.4",
|
|
123
123
|
"glob": "^8.0.3",
|
|
124
124
|
"rehype-parse": "^8.0.4",
|
|
125
125
|
"rehype-sanitize": "^5.0.1",
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
"path": "lib/common.css"
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
"limit": "
|
|
191
|
+
"limit": "51 kB",
|
|
192
192
|
"path": "bundle/bundle.umd.min.js"
|
|
193
193
|
}
|
|
194
194
|
],
|
package/src/common.css
CHANGED
|
@@ -92,6 +92,23 @@ html {
|
|
|
92
92
|
text-fill-color: transparent;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
.gradient-color-text-on-green {
|
|
96
|
+
background: linear-gradient(180deg, #cec833 0%, #7dae3c 100%);
|
|
97
|
+
-webkit-background-clip: text;
|
|
98
|
+
-webkit-text-fill-color: transparent;
|
|
99
|
+
text-fill-color: transparent;
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.gradient-color-text-on-yellow {
|
|
104
|
+
background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
|
|
105
|
+
linear-gradient(180deg, #cec833 0%, #7dae3c 100%);
|
|
106
|
+
-webkit-background-clip: text;
|
|
107
|
+
-webkit-text-fill-color: transparent;
|
|
108
|
+
text-fill-color: transparent;
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
}
|
|
111
|
+
|
|
95
112
|
input[type='range'].slider {
|
|
96
113
|
-webkit-appearance: none;
|
|
97
114
|
height: 4px;
|
package/src/components/Blocks.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ButtonBlock } from './ButtonBlock/ButtonBlock';
|
|
|
10
10
|
import { Calculator } from './Calculator/Calculator';
|
|
11
11
|
import { CardTransfer } from './CardTransfer/CardTransfer';
|
|
12
12
|
import { Carousel } from './Carousel/Carousel';
|
|
13
|
+
import { CarouselBankHistoryCard } from './CarouselBankHistoryCard/CarouselBankHistoryCard';
|
|
13
14
|
import { CarouselCard } from './CarouselCard/CarouselCard';
|
|
14
15
|
import { CarouselCatalogCard } from './CarouselCatalogCard/CarouselCatalogCard';
|
|
15
16
|
import { CarouselInvestmentCard } from './CarouselInvestmentCard/CarouselInvestmentCard';
|
|
@@ -71,6 +72,7 @@ export const Blocks: BlocksRegistry = {
|
|
|
71
72
|
Calculator,
|
|
72
73
|
CardTransfer,
|
|
73
74
|
Carousel,
|
|
75
|
+
CarouselBankHistoryCard,
|
|
74
76
|
CarouselCard,
|
|
75
77
|
CarouselCatalogCard,
|
|
76
78
|
CarouselInvestmentCard,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BlockRendererOptions } from '../../BlockRenderer/BlockRendererOptions';
|
|
2
2
|
import '../../setup-fixture';
|
|
3
3
|
import { Blocks } from '../Blocks';
|
|
4
|
+
import { BANK_HISTORY_CARD } from '../CarouselBankHistoryCard/CarouselBankHistoryCard.fixture';
|
|
4
5
|
import { CARD, CARD_MINI, CARD_NEW } from '../CarouselCard/CarouselCard.fixture';
|
|
5
6
|
import { CATALOG_CARD } from '../CarouselCatalogCard/CarouselCatalogCard.fixture';
|
|
6
7
|
import { INVESTMENT_CARD_WITH_SINGLE_COLUMN } from '../CarouselInvestmentCard/CarouselInvestmentCard.fixture';
|
|
@@ -175,4 +176,23 @@ export default {
|
|
|
175
176
|
/>
|
|
176
177
|
</div>
|
|
177
178
|
),
|
|
179
|
+
'bank-history': (
|
|
180
|
+
<div className="container grid grid-cols-12">
|
|
181
|
+
<Carousel
|
|
182
|
+
className="col-span-12"
|
|
183
|
+
isBlur={false}
|
|
184
|
+
isCyclic={false}
|
|
185
|
+
arrowsPadded={false}
|
|
186
|
+
visibleItemCount={3}
|
|
187
|
+
block={{
|
|
188
|
+
type: 'Carousel',
|
|
189
|
+
blocks: new Array(6).fill({
|
|
190
|
+
type: 'CarouselBankHistoryCard',
|
|
191
|
+
content: BANK_HISTORY_CARD,
|
|
192
|
+
}),
|
|
193
|
+
}}
|
|
194
|
+
options={options}
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
197
|
+
),
|
|
178
198
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
3
|
import { renderChildren } from '../../BlockRenderer/renderChildren';
|
|
4
|
+
import { BlockDef } from '../../model/ContentPageDef';
|
|
3
5
|
import type { JSXBlock, UniBlockProps } from '../../model/JSXBlock';
|
|
4
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
|
-
import { ScrollLeftButton, ScrollRightButton } from '../../ui-kit/Button/ArrowButton';
|
|
6
7
|
import { SwipeListContainer } from '../../ui-kit/SwipeListControl/SwipeListContainer';
|
|
7
|
-
import {
|
|
8
|
-
SwipeListScroll,
|
|
9
|
-
useSwipeListScroll,
|
|
10
|
-
} from '../../ui-kit/SwipeListControl/useSwipeListScroll';
|
|
11
|
-
import type { CarouselContent } from './CarouselContent';
|
|
8
|
+
import { useSwipeListScroll } from '../../ui-kit/SwipeListControl/useSwipeListScroll';
|
|
12
9
|
import { style } from '../../utils/style';
|
|
10
|
+
import type { CarouselContent } from './CarouselContent';
|
|
11
|
+
import { CarouselScrollButtons } from './CarouselScrollButtons';
|
|
13
12
|
|
|
14
13
|
export interface CarouselProps extends CarouselContent, UniBlockProps {
|
|
15
14
|
itemCount?: number;
|
|
@@ -17,9 +16,6 @@ export interface CarouselProps extends CarouselContent, UniBlockProps {
|
|
|
17
16
|
|
|
18
17
|
const ITEMS_GAP = 4;
|
|
19
18
|
|
|
20
|
-
const blurBaseStyle = 'absolute top-0 bottom-0 z-50 w-[84px] pointer-events-none';
|
|
21
|
-
const scrollButtonStyle = 'absolute top-[calc(50%-12px)] z-50';
|
|
22
|
-
|
|
23
19
|
export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
|
|
24
20
|
({
|
|
25
21
|
className = '',
|
|
@@ -27,17 +23,25 @@ export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
|
|
|
27
23
|
visibleItemCount,
|
|
28
24
|
isBlur = true,
|
|
29
25
|
isCyclic = false,
|
|
26
|
+
arrowsPadded = true,
|
|
30
27
|
isPadding = true,
|
|
31
28
|
...rest
|
|
32
29
|
}) => {
|
|
33
30
|
const { blocks: childBlocks } = rest.block || {};
|
|
34
31
|
const count = itemCount || childBlocks?.length || 0;
|
|
35
32
|
|
|
33
|
+
const [activeIndex, setActiveIndex] = useState<number>(Math.floor((visibleItemCount || 0) / 2));
|
|
34
|
+
|
|
35
|
+
const increaseActiveIndex = useCallback(() => setActiveIndex((_) => _ + 1), []);
|
|
36
|
+
const decreaseActiveIndex = useCallback(() => setActiveIndex((_) => _ - 1), []);
|
|
37
|
+
|
|
36
38
|
const [containerRef, scroll] = useSwipeListScroll<HTMLDivElement>({
|
|
37
39
|
itemCount: count,
|
|
38
40
|
isCyclic,
|
|
39
41
|
});
|
|
40
42
|
|
|
43
|
+
const isBankHistoryCarousel = childBlocks && childBlocks[0].type === 'CarouselBankHistoryCard';
|
|
44
|
+
|
|
41
45
|
return (
|
|
42
46
|
<BlockWrapper className={style(getPaddingStyle(isPadding), className)} {...rest}>
|
|
43
47
|
<div className="relative max-w-full">
|
|
@@ -48,15 +52,21 @@ export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
|
|
|
48
52
|
gap={ITEMS_GAP}
|
|
49
53
|
onVisibleIndicesChange={scroll.handleVisibleIndicesChange}
|
|
50
54
|
>
|
|
51
|
-
{renderChildren(
|
|
55
|
+
{renderChildren({
|
|
56
|
+
...rest,
|
|
57
|
+
block: { ...rest.block, blocks: buildBlocks(childBlocks, activeIndex) },
|
|
58
|
+
})}
|
|
52
59
|
</SwipeListContainer>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
<CarouselScrollButtons
|
|
61
|
+
scroll={scroll}
|
|
62
|
+
isBlur={isBlur}
|
|
63
|
+
arrowsPadded={arrowsPadded}
|
|
64
|
+
onScrollLeft={decreaseActiveIndex}
|
|
65
|
+
onScrollRight={increaseActiveIndex}
|
|
66
|
+
hasEdgeBlocks={isBankHistoryCarousel}
|
|
67
|
+
activeIndex={activeIndex}
|
|
68
|
+
itemCount={count}
|
|
69
|
+
/>
|
|
60
70
|
</div>
|
|
61
71
|
</BlockWrapper>
|
|
62
72
|
);
|
|
@@ -65,6 +75,7 @@ export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
|
|
|
65
75
|
|
|
66
76
|
Carousel.childrenTypes = [
|
|
67
77
|
'CarouselCard',
|
|
78
|
+
'CarouselBankHistoryCard',
|
|
68
79
|
'CarouselCatalogCard',
|
|
69
80
|
'CarouselInvestmentCard',
|
|
70
81
|
'CarouselProductCard',
|
|
@@ -74,20 +85,20 @@ Carousel.childrenTypes = [
|
|
|
74
85
|
'CarouselInvestmentCard',
|
|
75
86
|
];
|
|
76
87
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const buildBlocks = (blocks?: BlockDef[], activeIndex?: number) => {
|
|
89
|
+
return blocks && blocks[0].type === 'CarouselBankHistoryCard'
|
|
90
|
+
? blocks.map((_, i) => {
|
|
91
|
+
return {
|
|
92
|
+
..._,
|
|
93
|
+
content: {
|
|
94
|
+
..._.content,
|
|
95
|
+
orderNumber: i,
|
|
96
|
+
isActive: activeIndex === i,
|
|
97
|
+
blocksLength: blocks.length,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
})
|
|
101
|
+
: blocks;
|
|
102
|
+
};
|
|
92
103
|
|
|
93
104
|
const getPaddingStyle = (isPadding: boolean): string => (isPadding ? 'p-12' : '');
|
|
@@ -7,8 +7,13 @@ export interface CarouselContent {
|
|
|
7
7
|
* @enumNames ["auto", "1", "2", "3"]
|
|
8
8
|
*/
|
|
9
9
|
visibleItemCount?: 0 | 1 | 2 | 3 | 4;
|
|
10
|
-
/** @title Добавление блюра
|
|
10
|
+
/** @title Добавление блюра на стрелках*/
|
|
11
11
|
isBlur?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @title Добавление отступа на стрелках
|
|
14
|
+
* @default true
|
|
15
|
+
* */
|
|
16
|
+
arrowsPadded?: boolean;
|
|
12
17
|
/** @title Цикличность */
|
|
13
18
|
isCyclic?: boolean;
|
|
14
19
|
/** @title Внутренний отступ */
|