@redneckz/wildless-cms-uni-blocks 0.14.334 → 0.14.335
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/bundle.umd.js +11 -7
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ProductGallery/ProductGallery.d.ts +1 -1
- package/dist/components/ProductGallery/ProductGallery.d.ts +1 -1
- package/dist/components/ProductGallery/ProductGallery.js +12 -5
- package/dist/components/ProductGallery/ProductGallery.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/ProductGallery/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery/ProductGallery.js +12 -5
- package/lib/components/ProductGallery/ProductGallery.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/package.json +1 -1
- package/src/components/ProductGallery/ProductGallery.tsx +37 -7
package/package.json
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
import { JSX } from '@redneckz/uni-jsx';
|
|
2
1
|
import { useState } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
2
|
import { BaseProductTile } from '../../ui-kit/BaseProductTile/BaseProductTile';
|
|
4
3
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
4
|
+
import { ScrollLeftButton, ScrollRightButton } from '../../ui-kit/LinkButton/ArrowButton';
|
|
5
|
+
import { SwipeListContainer } from '../../ui-kit/SwipeListControl/SwipeListContainer';
|
|
6
|
+
import { useSwipeListScroll } from '../../ui-kit/SwipeListControl/useSwipeListScroll';
|
|
7
|
+
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
5
8
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
6
9
|
import { style } from '../../utils/style';
|
|
7
10
|
import { type ProductGalleryContent, type ProductSlide } from './ProductGalleryContent';
|
|
8
11
|
|
|
9
12
|
export interface ProductGalleryProps extends ProductGalleryContent, UniBlockProps {}
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
const scrollButtonStyle = 'hidden sm:flex absolute z-40 top-10';
|
|
15
|
+
|
|
16
|
+
export const ProductGallery = UniBlock<ProductGalleryProps>(
|
|
12
17
|
({ className = '', padding, slides = [], ...rest }) => {
|
|
13
18
|
const [activeSlideIndex, setActiveSlideIndex] = useState(0);
|
|
14
19
|
|
|
20
|
+
const [containerRef, scroll] = useSwipeListScroll<HTMLDivElement>({
|
|
21
|
+
itemCount: slides?.length || 0,
|
|
22
|
+
});
|
|
23
|
+
|
|
15
24
|
return (
|
|
16
25
|
<BlockWrapper
|
|
17
26
|
className={style('box-border overflow-hidden', className)}
|
|
18
|
-
defaultPadding="
|
|
27
|
+
defaultPadding="pt-6xl"
|
|
19
28
|
padding={padding}
|
|
20
29
|
{...rest}
|
|
21
30
|
>
|
|
@@ -36,8 +45,29 @@ export const ProductGallery = JSX<ProductGalleryProps>(
|
|
|
36
45
|
</div>
|
|
37
46
|
))}
|
|
38
47
|
</div>
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
|
|
49
|
+
<div className="relative pr-xs mt-m -mb-m flex gap-xs box-border">
|
|
50
|
+
<SwipeListContainer
|
|
51
|
+
containerRef={containerRef}
|
|
52
|
+
snapAlign="snap-start"
|
|
53
|
+
onVisibleIndicesChange={scroll.handleVisibleIndicesChange}
|
|
54
|
+
itemClassName={'h-40 flex items-stretch w-screen'}
|
|
55
|
+
gap={8}
|
|
56
|
+
>
|
|
57
|
+
{slides.map(renderNavButton({ activeSlideIndex, onClick: setActiveSlideIndex }))}
|
|
58
|
+
</SwipeListContainer>
|
|
59
|
+
{scroll.canScrollLeft ? (
|
|
60
|
+
<ScrollLeftButton
|
|
61
|
+
className={style('left-6', scrollButtonStyle)}
|
|
62
|
+
onClick={scroll.scrollLeft}
|
|
63
|
+
/>
|
|
64
|
+
) : null}
|
|
65
|
+
{scroll.canScrollRight ? (
|
|
66
|
+
<ScrollRightButton
|
|
67
|
+
className={style('right-6', scrollButtonStyle)}
|
|
68
|
+
onClick={scroll.scrollRight}
|
|
69
|
+
/>
|
|
70
|
+
) : null}
|
|
41
71
|
</div>
|
|
42
72
|
</BlockWrapper>
|
|
43
73
|
);
|
|
@@ -55,7 +85,7 @@ const renderNavButton =
|
|
|
55
85
|
const isActive = i === activeSlideIndex;
|
|
56
86
|
const btnClassName = isActive
|
|
57
87
|
? 'min-w-[350px] bg-white shadow-dark-blue border-none p-6'
|
|
58
|
-
: 'min-w-72 ease-in duration-300 bg-white/10 px-xl py-lg hover:
|
|
88
|
+
: 'min-w-72 ease-in duration-300 bg-white/10 px-xl py-lg hover:backdrop-blur';
|
|
59
89
|
const btnTitleClassName = isActive
|
|
60
90
|
? 'text-primary-text text-h6 py-xs'
|
|
61
91
|
: 'text-l pb-2xs text-secondary-text group-data-secondary:text-white';
|
|
@@ -70,7 +100,7 @@ const renderNavButton =
|
|
|
70
100
|
onClick={() => onClick(i)}
|
|
71
101
|
aria-label={nav?.title}
|
|
72
102
|
className={style(
|
|
73
|
-
'relative px-xl box-border overflow-hidden text-left grow basis-0 border border-gray group-data-secondary:border-white/50',
|
|
103
|
+
'max-h-28 mt-xs ml-xs relative px-xl box-border overflow-hidden text-left grow basis-0 border border-gray group-data-secondary:border-white/50',
|
|
74
104
|
btnClassName,
|
|
75
105
|
)}
|
|
76
106
|
>
|