fix: virtual slides

This commit is contained in:
ner committed 2024-03-23 13:20:53 +02:00
1 parent 97264226b6
commit 0e56de39db
8 files changed
+29 -41

No files matched your search

+13 -12
View File
@@ -24,22 +24,23 @@ const Card: FC<Props> = ({ movie, onClick, fit }) => {
const handleToggleFavorite = () => (isFavorite ? remove(movie.id) : add(movie));
return (
<motion.div
<div
onDoubleClick={handleToggleFavorite}
onTap={onClick}
className={cn(
'w-[300px] h-[450px] min-w-[300px] shrink-0 mx-auto',
fit ? 'w-full h-auto xs:w-[300px] xs:h-[450px]' : undefined
)}
>
<div className='flex flex-col w-full h-full mx-auto relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg'>
<Poster
title={movie.title}
size={100}
poster={movie.poster_path}
className={fit ? 'h-auto xs:h-full' : undefined}
/>
<div className='absolute left-0 top-0 w-full h-20 bg-gradient-to-t from-transparent to-black opacity-75'>
<motion.div className='flex flex-col w-full h-full mx-auto relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg'>
<motion.div onTap={onClick} className='flex'>
<Poster
title={movie.title}
size={100}
poster={movie.poster_path}
className={fit ? 'h-auto xs:h-full' : undefined}
/>
</motion.div>
<div className='absolute left-0 top-0 w-full h-20 bg-gradient-to-t from-transparent to-black opacity-75 rounded-t-lg'>
<div className='h-full w-full mx-auto pt-1 px-3 text-white'>
<div className='grid items-center grid-cols-[1fr_50px]'>
<Title key={movie.title} title={movie.title} />
@@ -59,8 +60,8 @@ const Card: FC<Props> = ({ movie, onClick, fit }) => {
iconsFillColor='fill-white'
/>
</div>
</div>
</motion.div>
</motion.div>
</div>
);
};
+1 -3
View File
@@ -1,6 +1,5 @@
import { FC } from 'react';
import { ImageOff } from 'lucide-react';
import Image from 'next/image';
import { cn } from '@/lib/utils';
@@ -13,9 +12,8 @@ interface Props {
const Poster: FC<Props> = ({ title, poster, size = 250, className }) => {
return poster ? (
<Image
<img
className={cn('rounded-lg mx-auto w-auto h-full object-fill', className)}
unoptimized
height={750}
width={500}
src={`https://image.tmdb.org/t/p/w500/${poster}`}
@@ -14,6 +14,7 @@ const Rating: FC<Props> = ({ isFavorite, rating, toggleFavorite, iconsFillColor
<span className='select-none flex w-full items-center ml-auto gap-1 mt-[-8px] justify-between'>
<motion.span
onTap={(event) => {
event.preventDefault();
event.stopPropagation();
toggleFavorite();