banner
This commit is contained in:
BIN
src/assets/gemma-c-stpjHJGqZyw-unsplash.jpg
Normal file
BIN
src/assets/gemma-c-stpjHJGqZyw-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
src/assets/photo-1506617420156-8e4536971650.jpg
Normal file
BIN
src/assets/photo-1506617420156-8e4536971650.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -1,23 +1,48 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import Banner from '@/assets/banner.webp';
|
import Banner from '@/assets/gemma-c-stpjHJGqZyw-unsplash.jpg';
|
||||||
|
import Banner_Two from '@/assets/photo-1506617420156-8e4536971650.jpg';
|
||||||
|
import Banner_Three from '@/assets/pngtree-supermarket-aisle-with-empty-shopping-cart-at-grocery-store-retail-business-image_15646095.jpg';
|
||||||
import { AspectRatio } from '@/shared/ui/aspect-ratio';
|
import { AspectRatio } from '@/shared/ui/aspect-ratio';
|
||||||
|
import { Button } from '@/shared/ui/button';
|
||||||
|
import {
|
||||||
|
Carousel,
|
||||||
|
CarouselContent,
|
||||||
|
CarouselItem,
|
||||||
|
type CarouselApi,
|
||||||
|
} from '@/shared/ui/carousel';
|
||||||
import useCategoryActive from '@/widgets/navbar/lib/openCategory';
|
import useCategoryActive from '@/widgets/navbar/lib/openCategory';
|
||||||
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
import { useState } from 'react';
|
||||||
import 'swiper/css';
|
import 'swiper/css';
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||||
import { categoryList } from '../lib/data';
|
import { categoryList } from '../lib/data';
|
||||||
|
|
||||||
|
const banner = [Banner, Banner_Two, Banner_Three];
|
||||||
|
|
||||||
const Welcome = () => {
|
const Welcome = () => {
|
||||||
const { setActive, setOpenToolbar } = useCategoryActive();
|
const { setActive, setOpenToolbar } = useCategoryActive();
|
||||||
|
const [api, setApi] = useState<CarouselApi>();
|
||||||
|
|
||||||
|
const scrollPrev = () => {
|
||||||
|
api?.scrollPrev();
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollNext = () => {
|
||||||
|
api?.scrollNext();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="custom-container">
|
<div className="custom-container">
|
||||||
{/* Banner */}
|
<Carousel className="w-full" setApi={setApi}>
|
||||||
<AspectRatio ratio={16 / 6} className="!p-0">
|
<CarouselContent className="!pr-[8%] sm:pr-0">
|
||||||
|
{banner.map((e, index) => (
|
||||||
|
<CarouselItem key={index} className="relative">
|
||||||
|
<AspectRatio ratio={16 / 8}>
|
||||||
<div className="relative w-full h-full">
|
<div className="relative w-full h-full">
|
||||||
<Image
|
<Image
|
||||||
src={Banner || '/placeholder.svg'}
|
src={e || '/placeholder.svg'}
|
||||||
alt="Banner"
|
alt="Banner"
|
||||||
fill
|
fill
|
||||||
className="rounded-2xl object-cover shadow-lg border border-slate-200"
|
className="rounded-2xl object-cover shadow-lg border border-slate-200"
|
||||||
@@ -25,6 +50,26 @@ const Welcome = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
|
<Button
|
||||||
|
onClick={scrollNext}
|
||||||
|
className="absolute bottom-5 right-5"
|
||||||
|
variant={'secondary'}
|
||||||
|
size={'icon'}
|
||||||
|
>
|
||||||
|
<ChevronRight className="size-6" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={scrollPrev}
|
||||||
|
className="absolute bottom-5 right-16"
|
||||||
|
variant={'secondary'}
|
||||||
|
size={'icon'}
|
||||||
|
>
|
||||||
|
<ChevronLeft className="size-6" />
|
||||||
|
</Button>
|
||||||
|
</CarouselItem>
|
||||||
|
))}
|
||||||
|
</CarouselContent>
|
||||||
|
</Carousel>
|
||||||
|
|
||||||
{/* Category Slider */}
|
{/* Category Slider */}
|
||||||
<div className="mx-auto mt-5 max-lg:hidden">
|
<div className="mx-auto mt-5 max-lg:hidden">
|
||||||
|
|||||||
Reference in New Issue
Block a user