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}
|
{...slideEffectProps}
|
||||||
>
|
>
|
||||||
{movies?.map((movie, index) => (
|
{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} />
|
<Card fit movie={movie} />
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
))}
|
))}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
|
|||||||
<body>
|
<body>
|
||||||
<Providers theme={theme}>
|
<Providers theme={theme}>
|
||||||
<Header />
|
<Header />
|
||||||
<main className='px-2 max-w-[1260px] mx-auto'>{children}</main>
|
<main className='px-2 max-w-[1252px] mx-auto'>{children}</main>
|
||||||
</Providers>
|
</Providers>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import ToggleTheme from './components/ThemeToggle';
|
|||||||
|
|
||||||
const Header: FC = () => (
|
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'>
|
<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'>
|
<div className='flex items-center justify-between gap-2 md:flex-nowrap'>
|
||||||
<Link href='/' shallow legacyBehavior>
|
<Link href='/' shallow legacyBehavior>
|
||||||
<Badge className='whitespace-nowrap'>Movie advisor</Badge>
|
<Badge className='whitespace-nowrap cursor-pointer'>Movie advisor</Badge>
|
||||||
</Link>
|
</Link>
|
||||||
<Navigation className='hidden sm:flex' />
|
<Navigation className='hidden sm:flex' />
|
||||||
<div className='flex items-center gap-2'>
|
<div className='flex items-center gap-2'>
|
||||||
|
|||||||
@@ -27,18 +27,13 @@ const Card: FC<Props> = ({ movie, onClick, fit }) => {
|
|||||||
<div
|
<div
|
||||||
onDoubleClick={handleToggleFavorite}
|
onDoubleClick={handleToggleFavorite}
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-[300px] h-[450px] min-w-[300px] min-h-[450px] shrink-0 mx-auto',
|
'w-[300px] h-[450px] shrink-0 mx-auto relative',
|
||||||
fit ? 'w-full h-auto xs:w-[300px] xs:h-[450px]' : undefined
|
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 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 h-full'>
|
<motion.div onTap={onClick} className='flex w-full h-full'>
|
||||||
<Poster
|
<Poster title={movie.title} size={100} poster={movie.poster_path} />
|
||||||
title={movie.title}
|
|
||||||
size={100}
|
|
||||||
poster={movie.poster_path}
|
|
||||||
className={fit ? 'h-auto min-h-[450px] xs:h-full' : undefined}
|
|
||||||
/>
|
|
||||||
</motion.div>
|
</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='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='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
|
<motion.li
|
||||||
key={movie.id}
|
key={movie.id}
|
||||||
variants={item}
|
variants={item}
|
||||||
className='flex cursor-pointer'
|
className='flex xs:w-auto w-full cursor-pointer'
|
||||||
ref={isAnchor ? (element) => setLoader(element!) : undefined}
|
ref={isAnchor ? (element) => setLoader(element!) : undefined}
|
||||||
>
|
>
|
||||||
<Card fit movie={movie} onClick={() => showPreviewModal({ movie, onClose: onPreviewClose })} />
|
<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'>
|
<div className='flex flex-col lg:flex-row max-w-[100%] gap-2'>
|
||||||
{card || <Card fit={fit} movie={movie} />}
|
{card || <Card fit={fit} movie={movie} />}
|
||||||
<div className='flex flex-col grow'>
|
<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'>
|
<div className='flex w-full gap-2'>
|
||||||
<Actions movie={movie} onClose={onClose} />
|
<Actions movie={movie} onClose={onClose} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
import { ImageOff } from 'lucide-react';
|
import { ImageOff } from 'lucide-react';
|
||||||
|
|
||||||
import { cn } from '@/lib/utils';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
poster: string;
|
poster: string;
|
||||||
size: number;
|
size: number;
|
||||||
className?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Poster: FC<Props> = ({ title, poster, size = 250, className }) => {
|
const Poster: FC<Props> = ({ title, poster, size = 250 }) => {
|
||||||
return poster ? (
|
return poster ? (
|
||||||
<img
|
<img
|
||||||
className={cn('rounded-lg mx-auto w-auto h-full object-fill', className)}
|
className='rounded-lg w-full h-full object-fill'
|
||||||
height={750}
|
|
||||||
width={500}
|
|
||||||
src={`https://image.tmdb.org/t/p/w500/${poster}`}
|
src={`https://image.tmdb.org/t/p/w500/${poster}`}
|
||||||
alt={title}
|
alt={title}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user