-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added products carousel to cart panel
- Loading branch information
1 parent
c4a4d4a
commit 3a04b43
Showing
7 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/commerce/components/cart-panel/products-carousel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Spline from '@splinetool/react-spline' | ||
import Image from 'next/image' | ||
|
||
import type { LineItem } from '../../types' | ||
import { | ||
Carousel, | ||
CarouselContent, | ||
CarouselItem, | ||
CarouselPrevious, | ||
CarouselNext | ||
} from '@hanzo/ui/primitives' | ||
|
||
const ProductsCarousel: React.FC<{ | ||
items: LineItem[] | ||
}> = ({ | ||
items, | ||
}) => { | ||
|
||
return ( | ||
<Carousel | ||
options={{ | ||
loop: true | ||
}} | ||
className='w-full max-w-sm mx-auto px-2' | ||
> | ||
<CarouselContent> | ||
{items.map(({title, img, video}, index) => ( | ||
<CarouselItem key={index}> | ||
<div className='flex aspect-square items-center justify-center p-6'> | ||
{video ? ( | ||
<Spline | ||
scene={video} | ||
className='!aspect-[12/10] pointer-events-none !w-auto !h-auto' | ||
/> | ||
) : ( | ||
<Image | ||
src={img ?? ''} | ||
alt={title + ' image'} | ||
height={250} | ||
width={250} | ||
className='m-auto' | ||
/> | ||
)} | ||
</div> | ||
</CarouselItem> | ||
))} | ||
</CarouselContent> | ||
<CarouselPrevious /> | ||
<CarouselNext /> | ||
</Carousel> | ||
) | ||
} | ||
|
||
export default ProductsCarousel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.