diff --git a/app/(site)/components/Trending/index.tsx b/app/(site)/components/Trending/index.tsx index 4965827..802f680 100644 --- a/app/(site)/components/Trending/index.tsx +++ b/app/(site)/components/Trending/index.tsx @@ -1,22 +1,43 @@ 'use client'; -import { FC } from 'react'; +import { FC, useState } from 'react'; import Marquee from '@/components/Marquee'; -import { Badge } from '@/components/ui/badge'; +import Nav from '@/components/ui/nav'; import useTrending from './useTrending'; -const Trending: FC<{ label: string; type: 'trending' | 'streaming' | 'theater' | 'rent' }> = ({ label, type }) => { +const tabs = [ + { + title: 'Trending', + type: 'trending' + }, + { + title: 'Streaming', + type: 'streaming' + }, + { + title: 'In theaters', + type: 'theater' + } +]; + +const Trending: FC = () => { + const [active, setActive] = useState(tabs[0]); const isMobile = typeof window === 'undefined' ? true : matchMedia('(max-width: 600px)').matches; - const { data: movies, isFetched } = useTrending({ type, enabled: !isMobile }); + + const { data: trending, isFetched } = useTrending({ type: 'trending', enabled: !isMobile }); + const { data: streaming } = useTrending({ type: 'streaming', enabled: !isMobile }); + const { data: theater } = useTrending({ type: 'theater', enabled: !isMobile }); + + const movies = { trending, streaming, theater }[active.type] || []; return ( isFetched && ( - <> - {label} - - +
+