feat: scroll navigation
This commit is contained in:
1 parent
eaaf46082c
commit
058ecd452f
7 files changed
+238
-132
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import { showPreviewModal } from '@/components/Preview';
|
||||
import ScrollNavigation from '@/components/ScrollNavigation';
|
||||
import Card from '@/components/Show';
|
||||
|
||||
interface Props {
|
||||
shows: Show[];
|
||||
}
|
||||
|
||||
const Gallery: FC<Props> = ({ shows }) => (
|
||||
<ScrollNavigation<HTMLUListElement>>
|
||||
{(setRef) => (
|
||||
<ul
|
||||
ref={setRef}
|
||||
className='no-scrollbar flex animate-fade-aside-slide-in snap-x snap-mandatory gap-2 overflow-auto rounded-lg opacity-0'
|
||||
>
|
||||
{shows.map((show) => (
|
||||
<li key={show.id} className='snap-start'>
|
||||
<Card className='!h-[350px] !w-[230px] text-sm' show={show} onClick={() => showPreviewModal({ show })} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</ScrollNavigation>
|
||||
);
|
||||
|
||||
export default Gallery;
|
||||
@@ -1,20 +0,0 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
import { showPreviewModal } from '@/components/Preview';
|
||||
import Card from '@/components/Show';
|
||||
|
||||
interface Props {
|
||||
shows: Show[];
|
||||
}
|
||||
|
||||
const Marquee: FC<Props> = ({ shows }) => (
|
||||
<ul className='no-scrollbar flex animate-fade-aside-slide-in snap-x snap-mandatory gap-2 overflow-auto rounded-lg opacity-0'>
|
||||
{shows.map((show) => (
|
||||
<li key={show.id} className='snap-start'>
|
||||
<Card className='!h-[350px] !w-[230px] text-sm' show={show} onClick={() => showPreviewModal({ show })} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
|
||||
export default Marquee;
|
||||
@@ -4,7 +4,7 @@ import { FC, useState } from 'react';
|
||||
|
||||
import Nav from '@/components/ui/nav';
|
||||
|
||||
import Marquee from './components/Marquee';
|
||||
import Gallery from './components/Gallery';
|
||||
import { tabs } from './constants';
|
||||
import useTrending from './useTrending';
|
||||
|
||||
@@ -22,7 +22,7 @@ const Trending: FC = () => {
|
||||
isFetched && (
|
||||
<div>
|
||||
<Nav tabs={tabs} active={active} onChange={(active) => setActive(active)} className='mb-3' />
|
||||
<Marquee key={active.type} shows={shows} />
|
||||
<Gallery key={active.type} shows={shows} />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user