fix: list animation
This commit is contained in:
1 parent
345e7cfc90
commit
5f0dac673d
3 files changed
+14
-12
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
|
||||
import Poster from '@/components/Movie/components/Poster';
|
||||
import Rating from '@/components/Movie/components/Rating';
|
||||
@@ -8,14 +9,17 @@ interface Props {
|
||||
movie?: Movie;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const Card: FC<Props> = ({ movie, className, children }) => {
|
||||
const Card: FC<Props> = ({ movie, className, children, onClick }) => {
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
<div className={`${className} rounded-lg bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg`}>
|
||||
<div className='flex justify-center relative grow overflow-hidden rounded-lg'>
|
||||
<div
|
||||
className={`${className} rounded-lg relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg`}
|
||||
>
|
||||
<motion.div className='flex justify-center grow' onTap={onClick}>
|
||||
<Poster title={movie.title} width={300} height={450} size={100} poster={movie.poster_path} />
|
||||
{children}
|
||||
<div className='absolute left-0 top-0 w-full h-20 bg-gradient-to-t from-transparent to-black opacity-80'>
|
||||
@@ -30,9 +34,9 @@ const Card: FC<Props> = ({ movie, className, children }) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='absolute left-0 bottom-0 w-full bg-gradient-to-t from-black to-transparent h-20 text-white p-3 pb-2 flex flex-col justify-end opacity-80'>
|
||||
<Rating movie={movie} iconsFillColor='fill-white' />
|
||||
</div>
|
||||
</motion.div>
|
||||
<div className='absolute left-0 bottom-0 w-full bg-gradient-to-t from-black to-transparent h-20 text-white p-3 pb-2 flex flex-col justify-end opacity-80'>
|
||||
<Rating movie={movie} iconsFillColor='fill-white' />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user