diff --git a/app/app.css b/app/app.css index e743c14..4ef6f59 100644 --- a/app/app.css +++ b/app/app.css @@ -28,3 +28,27 @@ table.dataTable tbody > tr > td { border-right: none !important; border-bottom: 1px solid #ebebeb; } + +/* .embla.hero { + overflow: hidden; +} +.embla__container.hero { + display: flex; + background-color: yellow; +} +.embla__slide.hero { + flex: 0 0 100%; + min-width: 0; +} */ + +.embla__slide { + margin-right: 10px; + flex: 0 0 auto; + min-width: 0; + max-width: 100%; +} +@media (min-width: 768px) { + .embla__slide { + margin-right: 30px; + } +} diff --git a/app/components/ui/carousel-hero.tsx b/app/components/ui/carousel-hero.tsx new file mode 100644 index 0000000..54d4211 --- /dev/null +++ b/app/components/ui/carousel-hero.tsx @@ -0,0 +1,99 @@ +import useEmblaCarousel from 'embla-carousel-react' +import { useCallback } from 'react' +import { Link } from 'react-router' + +import { CarouselNextIcon } from '~/components/icons/carousel-next' +import { CarouselPreviousIcon } from '~/components/icons/carousel-previous' +import { Button } from '~/components/ui/button' +import { useNewsContext } from '~/contexts/news' +import type { TNews } from '~/types/news' + +export const CarouselHero = (properties: TNews) => { + const { setIsSuccessOpen } = useNewsContext() + const { title, description, items } = properties + const [emblaReference, emblaApi] = useEmblaCarousel({ loop: true }) + + const previousSlide = useCallback(() => { + if (emblaApi) emblaApi.scrollPrev() + }, [emblaApi]) + + const nextSlide = useCallback(() => { + if (emblaApi) emblaApi.scrollNext() + }, [emblaApi]) + + return ( +
+ {description} +
++ {content} +
++ {description} +
++ {content} +
+