diff --git a/app/api/config.ts b/app/api/config.ts index 316d19e..a685cb3 100644 --- a/app/api/config.ts +++ b/app/api/config.ts @@ -74,5 +74,8 @@ export const ENDPOINTS = { releaseInCollections: `${API_PREFIX}/collection/all/release`, userCollections: `${API_PREFIX}/collection/all/profile`, favoriteCollections: `${API_PREFIX}/collectionFavorite`, + }, + discover: { + interesting: `${API_PREFIX}/discover/interesting`, } }; diff --git a/app/components/Discovery/InterestingCarousel.module.css b/app/components/Discovery/InterestingCarousel.module.css new file mode 100644 index 0000000..ed205c5 --- /dev/null +++ b/app/components/Discovery/InterestingCarousel.module.css @@ -0,0 +1,21 @@ +.swiper-button:global(.swiper-button-disabled) { + opacity: 0 !important; +} + +.swiper-button { + display: none !important; +} + +@media (hover: hover) and (min-width: 1024px) { + .swiper { + overflow: visible !important; + } +} + +@media (hover: hover) { + .swiper:hover .swiper-button { + display: flex !important; + width: 64px; + height: 64px; + } +} diff --git a/app/components/Discovery/InterestingCarousel.tsx b/app/components/Discovery/InterestingCarousel.tsx new file mode 100644 index 0000000..7740c8f --- /dev/null +++ b/app/components/Discovery/InterestingCarousel.tsx @@ -0,0 +1,91 @@ +"use client"; + +import { ENDPOINTS } from "#/api/config"; +import { useSWRfetcher } from "#/api/utils"; +import useSWR from "swr"; +import Image from "next/image"; +import { Swiper, SwiperSlide } from "swiper/react"; +import "swiper/css"; +import "swiper/css/navigation"; +import { Navigation } from "swiper/modules"; +import Styles from "./InterestingCarousel.module.css"; +import Link from "next/link"; + +export const InterestingCarousel = () => { + const { data, isLoading, error } = useSWR( + ENDPOINTS.discover.interesting, + useSWRfetcher, + { + revalidateOnFocus: false, + revalidateIfStale: false, + revalidateOnReconnect: false, + } + ); + + if (error) + return ( +
Произошла ошибка загрузки интересных релизов
+{item.title}
+{item.description}
+