fix: poster height

This commit is contained in:
ner committed 2023-08-05 16:33:13 +03:00
1 parent a4f420821a
commit 0cb860d0a0
3 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ const Card: FC<Props> = ({ movie, className }) => {
<span className='text-lg font-semibold'>{movie.vote_average}</span> <span className='text-lg font-semibold'>{movie.vote_average}</span>
</div> </div>
</div> </div>
<div className='flex justify-center relative mt-1 h-full'> <div className='flex justify-center relative mt-1'>
<Poster title={movie.title} width={300} height={450} size={100} poster={movie.poster_path} /> <Poster title={movie.title} width={300} height={450} size={100} poster={movie.poster_path} />
</div> </div>
</div> </div>
+3 -1
View File
@@ -15,7 +15,9 @@ interface Props {
const Preview: FC<Props> = ({ movie, className }) => { const Preview: FC<Props> = ({ movie, className }) => {
const { data: credits } = useCredits({ movieId: movie?.id }); const { data: credits } = useCredits({ movieId: movie?.id });
if (!movie) return null; if (!movie) return null;
return ( return (
<div className={`p-3 rounded-lg border bg-card text-card-foreground shadow-sm ${className}`}> <div className={`p-3 rounded-lg border bg-card text-card-foreground shadow-sm ${className}`}>
<div className='flex flex-col lg:flex-row max-w-[100%] gap-3 overflow-hidden'> <div className='flex flex-col lg:flex-row max-w-[100%] gap-3 overflow-hidden'>
@@ -23,7 +25,7 @@ const Preview: FC<Props> = ({ movie, className }) => {
title={movie.title} title={movie.title}
width={300} width={300}
height={450} height={450}
size={250} size={100}
poster={movie.poster_path} poster={movie.poster_path}
className='max-w-[300px]' className='max-w-[300px]'
/> />
+3 -5
View File
@@ -13,12 +13,10 @@ interface Props {
const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className }) => { const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className }) => {
return ( return (
<div <div className={`w-full flex flex-col rounded-lg overflow-hidden shrink-0 lg:m-0 mx-auto relative ${className}`}>
className={`h-[${height}px] w-full flex flex-col rounded-lg overflow-hidden shrink-0 relative m-auto lg:m-0 ${className}`}
>
{poster ? ( {poster ? (
<Image <Image
className='rounded-lg m-auto' className='rounded-lg mx-auto'
unoptimized unoptimized
height={height} height={height}
width={width} width={width}
@@ -26,7 +24,7 @@ const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className
alt={title} alt={title}
/> />
) : ( ) : (
<div className={'w-full h-full grow flex items-center justify-center rounded-lg border'}> <div className={`h-[${height}px] w-full flex items-center justify-center rounded-lg border`}>
<ImageOff size={size} strokeWidth={1} /> <ImageOff size={size} strokeWidth={1} />
</div> </div>
)} )}