feat: trending blocks on main page

This commit is contained in:
ner committed 2024-09-02 19:57:54 +03:00
1 parent 8263a4abd4
commit aff28018f6
8 files changed
+122 -19

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { FC } from 'react';
import Card from '../Movie/Card';
import { showPreviewModal } from '../Movie/Preview';
interface Props {
movies: Movie[];
}
const Marquee: FC<Props> = ({ movies }) => {
return (
<ul className='flex overflow-auto gap-2 rounded-lg snap-mandatory snap-x no-scrollbar'>
{movies.map((movie) => (
<li key={movie.id} className='snap-start'>
<Card className='!h-[250px] !w-[175px] text-sm' movie={movie} onClick={() => showPreviewModal({ movie })} />
</li>
))}
</ul>
);
};
export default Marquee;
+2 -2
View File
@@ -21,7 +21,7 @@ const Card: FC<Props> = ({ movie, onClick, className, containerProps }) => {
<div
{...(containerProps || {})}
className={cn(
'card-aspect-ratio relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg',
'card-aspect-ratio relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg text-lg',
className
)}
>
@@ -30,7 +30,7 @@ const Card: FC<Props> = ({ movie, onClick, className, containerProps }) => {
</div>
<div className='text-white absolute w-full h-full top-0 left-0 rounded-md flex flex-col justify-between p-2 card-gradient'>
<Handlers movie={movie} onClick={onClick} />
<div className='grid grid-cols-[1fr_auto] text-lg opacity-75 gap-2'>
<div className='grid grid-cols-[1fr_auto] opacity-75 gap-2'>
<span className='overflow-ellipsis overflow-hidden whitespace-nowrap'>{movie.name || movie.title}</span>
{Boolean(movie.release_date) && <span>{new Date(movie.release_date).getFullYear()}</span>}
</div>