fix: image aspect ration
This commit is contained in:
1 parent
48f43afef2
commit
0357f23cae
7 files changed
+13
-23
No files matched your search
@@ -59,7 +59,7 @@ export default function Container() {
|
||||
{...slideEffectProps}
|
||||
>
|
||||
{movies?.map((movie, index) => (
|
||||
<SwiperSlide key={movie.id} virtualIndex={index}>
|
||||
<SwiperSlide key={movie.id} virtualIndex={index} className='cursor-grab active:cursor-grabbing'>
|
||||
<Card fit movie={movie} />
|
||||
</SwiperSlide>
|
||||
))}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
<body>
|
||||
<Providers theme={theme}>
|
||||
<Header />
|
||||
<main className='px-2 max-w-[1260px] mx-auto'>{children}</main>
|
||||
<main className='px-2 max-w-[1252px] mx-auto'>{children}</main>
|
||||
</Providers>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,10 +9,10 @@ import ToggleTheme from './components/ThemeToggle';
|
||||
|
||||
const Header: FC = () => (
|
||||
<header className='flex justify-center bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky py-2 top-0 z-20'>
|
||||
<div className='max-w-[1260px] w-full px-2'>
|
||||
<div className='max-w-[1252px] w-full px-2'>
|
||||
<div className='flex items-center justify-between gap-2 md:flex-nowrap'>
|
||||
<Link href='/' shallow legacyBehavior>
|
||||
<Badge className='whitespace-nowrap'>Movie advisor</Badge>
|
||||
<Badge className='whitespace-nowrap cursor-pointer'>Movie advisor</Badge>
|
||||
</Link>
|
||||
<Navigation className='hidden sm:flex' />
|
||||
<div className='flex items-center gap-2'>
|
||||
|
||||
@@ -27,18 +27,13 @@ const Card: FC<Props> = ({ movie, onClick, fit }) => {
|
||||
<div
|
||||
onDoubleClick={handleToggleFavorite}
|
||||
className={cn(
|
||||
'w-[300px] h-[450px] min-w-[300px] min-h-[450px] shrink-0 mx-auto',
|
||||
fit ? 'w-full h-auto xs:w-[300px] xs:h-[450px]' : undefined
|
||||
'w-[300px] h-[450px] shrink-0 mx-auto relative',
|
||||
fit ? 'xs:w-[300px] xs:h-[450px] w-full h-full aspect-w-2 aspect-h-3' : undefined
|
||||
)}
|
||||
>
|
||||
<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 h-full'>
|
||||
<Poster
|
||||
title={movie.title}
|
||||
size={100}
|
||||
poster={movie.poster_path}
|
||||
className={fit ? 'h-auto min-h-[450px] xs:h-full' : undefined}
|
||||
/>
|
||||
<motion.div className='absolute top-0 left-0 flex flex-col w-full h-full mx-auto bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg'>
|
||||
<motion.div onTap={onClick} className='flex w-full h-full'>
|
||||
<Poster title={movie.title} size={100} poster={movie.poster_path} />
|
||||
</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'>
|
||||
|
||||
@@ -69,7 +69,7 @@ const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, withBottomGap = tr
|
||||
<motion.li
|
||||
key={movie.id}
|
||||
variants={item}
|
||||
className='flex cursor-pointer'
|
||||
className='flex xs:w-auto w-full cursor-pointer'
|
||||
ref={isAnchor ? (element) => setLoader(element!) : undefined}
|
||||
>
|
||||
<Card fit movie={movie} onClick={() => showPreviewModal({ movie, onClose: onPreviewClose })} />
|
||||
|
||||
@@ -29,7 +29,7 @@ const Preview: FC<Props> = ({ movie, className, onClose, children, card, fit })
|
||||
<div className='flex flex-col lg:flex-row max-w-[100%] gap-2'>
|
||||
{card || <Card fit={fit} movie={movie} />}
|
||||
<div className='flex flex-col grow'>
|
||||
{children && <div className='flex hover-none:hidden w-full mb-2 gap-2'>{children}</div>}
|
||||
{children && <div className='flex hover-none:hidden w-full max-sm:mb-0 mb-2 gap-2'>{children}</div>}
|
||||
<div className='flex w-full gap-2'>
|
||||
<Actions movie={movie} onClose={onClose} />
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
import { FC } from 'react';
|
||||
import { ImageOff } from 'lucide-react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
poster: string;
|
||||
size: number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const Poster: FC<Props> = ({ title, poster, size = 250, className }) => {
|
||||
const Poster: FC<Props> = ({ title, poster, size = 250 }) => {
|
||||
return poster ? (
|
||||
<img
|
||||
className={cn('rounded-lg mx-auto w-auto h-full object-fill', className)}
|
||||
height={750}
|
||||
width={500}
|
||||
className='rounded-lg w-full h-full object-fill'
|
||||
src={`https://image.tmdb.org/t/p/w500/${poster}`}
|
||||
alt={title}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user