Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
sync demo
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-phan committed Mar 5, 2024
1 parent 823aa14 commit 0005d63
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 1,134 deletions.
38 changes: 18 additions & 20 deletions app/components/product-form/product-media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ export function ProductMedia(props: ProductMediaProps) {
},
};

let [activeInd, setAcitveInd] = useState(0);
const [sliderRef, instanceRef] = useKeenSlider({
let [activeInd, setActiveInd] = useState(0);
let [sliderRef, instanceRef] = useKeenSlider({
...slideOptions,
slideChanged(slider) {
slideChanged: (slider) => {
let pos = slider.track.details.rel;
setAcitveInd(pos);
setActiveInd(pos);
let maxThumbnailIndex =
thumbnailInstance.current?.track.details.maxIdx || 0;
let thumbnailNext = Math.min(
Expand All @@ -54,19 +54,18 @@ export function ProductMedia(props: ProductMediaProps) {
thumbnailInstance.current?.moveToIdx(thumbnailNext);
},
});
let moveToIdx = useCallback(
(idx: number) => {
setAcitveInd(idx);
if (instanceRef.current) {
instanceRef.current.moveToIdx(idx);
}
},
[instanceRef],
);
const [thumbnailRef, thumbnailInstance] = useKeenSlider(thumbnailOptions);
let handleClickThumbnail = (idx: number) => {

function moveToIdx(idx: number) {
setActiveInd(idx);
if (instanceRef.current) {
instanceRef.current.moveToIdx(idx);
}
}

let [thumbnailRef, thumbnailInstance] = useKeenSlider(thumbnailOptions);
function handleClickThumbnail(idx: number) {
moveToIdx(idx);
};
}

useEffect(() => {
// instanceRef.current?.update(slideOptions);
Expand All @@ -77,13 +76,12 @@ export function ProductMedia(props: ProductMediaProps) {
});
moveToIdx(selectedInd);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedVariant?.id, moveToIdx]);
}, [selectedVariant?.id]);

return (
<div
className="grid vt-product-image"
style={{
gap: spacing,
}}
style={{ gap: spacing, }}
>
<div ref={sliderRef} className="keen-slider">
{media.map((med, i) => {
Expand Down
7 changes: 0 additions & 7 deletions app/routes/$.tsx

This file was deleted.

240 changes: 0 additions & 240 deletions app/routes/($locale).account.activate.$id.$activationToken.tsx

This file was deleted.

Loading

0 comments on commit 0005d63

Please sign in to comment.