feat: aspect-ratio instead of width measurer
This commit is contained in:
1 parent
375ebf93d9
commit
279a61ddcd
15 files changed
+123
-268
No files matched your search
@@ -1,70 +1,33 @@
|
||||
'use client';
|
||||
|
||||
import { forwardRef, ReactNode, startTransition, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
||||
import { Virtuoso, VirtuosoHandle, VirtuosoProps } from 'react-virtuoso';
|
||||
import { forwardRef, useEffect, useLayoutEffect, useRef } from 'react';
|
||||
import { StateSnapshot, Virtuoso, VirtuosoHandle, VirtuosoProps } from 'react-virtuoso';
|
||||
|
||||
import Card from '@/components/Movie/Card';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const components: VirtuosoProps<Movie, number>['components'] = {
|
||||
Item: (props) => <div {...props} className='shrink-0' style={{ ...props.style, width: props.context }} />,
|
||||
List: forwardRef(function List(props, ref) {
|
||||
return (
|
||||
<div {...props} ref={ref} className='gap-2' style={{ ...props.style, display: 'flex', width: props.context }} />
|
||||
);
|
||||
}),
|
||||
Scroller: forwardRef(function Scroller(props, ref) {
|
||||
return <div {...props} ref={ref} className='overflow-hidden no-scrollbar snap-mandatory snap-x rounded-lg' />;
|
||||
})
|
||||
};
|
||||
let snapshot: StateSnapshot;
|
||||
|
||||
export const Measurer = ({ children }: { children: (width: number) => ReactNode }) => {
|
||||
const [ref, setRef] = useState<HTMLDivElement | null>(null);
|
||||
const width = ref?.offsetWidth;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div ref={setRef} />
|
||||
{children(width || 0)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const Carousel = ({
|
||||
const Carousel = ({
|
||||
index,
|
||||
movies,
|
||||
width: initialWidth,
|
||||
onIndexChange
|
||||
}: {
|
||||
index: number;
|
||||
movies?: Movie[];
|
||||
width: number;
|
||||
onIndexChange: (index: number) => void;
|
||||
}) => {
|
||||
const timeout = useRef<NodeJS.Timeout>();
|
||||
const isMobile = matchMedia('(max-width: 500px)').matches;
|
||||
const ref = useRef<VirtuosoHandle>(null);
|
||||
const initialIndex = useRef(index);
|
||||
const [snap, setSnap] = useState(true);
|
||||
|
||||
const width = isMobile ? initialWidth : 300;
|
||||
const height = isMobile ? (width * 3) / 2 : 450;
|
||||
useEffect(() => {
|
||||
const virtuoso = ref.current;
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!ref.current) return;
|
||||
if (!virtuoso) return;
|
||||
|
||||
ref.current.scrollIntoView({ index: initialIndex.current });
|
||||
return () => virtuoso.getState((state) => (snapshot = state));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let pressed = false;
|
||||
|
||||
const scrollTo = ({ key }: globalThis.KeyboardEvent) => {
|
||||
if (['ArrowLeft', 'ArrowRight'].includes(key)) {
|
||||
pressed = true;
|
||||
setSnap(false);
|
||||
}
|
||||
|
||||
if (key === 'ArrowLeft') {
|
||||
if (index <= 0) return;
|
||||
ref.current?.scrollIntoView({ index: index - 1, behavior: 'smooth' });
|
||||
@@ -80,32 +43,66 @@ export const Carousel = ({
|
||||
|
||||
return () => {
|
||||
document.removeEventListener('keydown', scrollTo);
|
||||
pressed && setTimeout(() => setSnap(true), 100);
|
||||
};
|
||||
}, [index, movies?.length]);
|
||||
|
||||
return (
|
||||
<div className='card-aspect-ratio mx-auto'>
|
||||
<Virtuoso
|
||||
ref={ref}
|
||||
data={movies}
|
||||
defaultItemHeight={height}
|
||||
style={{ width, height, flexShrink: 0, margin: '0 auto' }}
|
||||
totalCount={movies?.length}
|
||||
context={onIndexChange}
|
||||
horizontalDirection
|
||||
context={width}
|
||||
increaseViewportBy={154}
|
||||
components={components}
|
||||
itemContent={(index) => {
|
||||
clearTimeout(timeout.current);
|
||||
|
||||
timeout.current = setTimeout(() => {
|
||||
const currentIndex = index - 1;
|
||||
|
||||
startTransition(() => onIndexChange(currentIndex));
|
||||
}, 50);
|
||||
|
||||
return <Card className={cn(snap && 'snap-start')} movie={movies?.[index]} />;
|
||||
}}
|
||||
skipAnimationFrameInResizeObserver
|
||||
increaseViewportBy={1000}
|
||||
restoreStateFrom={snapshot}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const components: VirtuosoProps<Movie, (index: number) => void>['components'] = {
|
||||
Item: ({ item, children, context: onIndexChange, ...props }) => {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const index = props['data-index'];
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const container = ref.current;
|
||||
|
||||
if (!container) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) =>
|
||||
entries.forEach((entry) => {
|
||||
if (!entry.isIntersecting) return;
|
||||
|
||||
onIndexChange?.(index);
|
||||
}),
|
||||
{
|
||||
threshold: 0.7
|
||||
}
|
||||
);
|
||||
|
||||
observer.observe(container);
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, [onIndexChange, index]);
|
||||
|
||||
return (
|
||||
<div {...props} ref={ref} className='snap-start'>
|
||||
<Card movie={item} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
List: forwardRef(function List({ context, ...props }, ref) {
|
||||
return <div {...props} ref={ref} style={{ ...props.style, display: 'flex' }} className='gap-2' />;
|
||||
}),
|
||||
Scroller: forwardRef(function Scroller({ context, ...props }, ref) {
|
||||
return (
|
||||
<div {...props} ref={ref} className='overflow-hidden no-scrollbar snap-mandatory snap-x rounded-lg h-full' />
|
||||
);
|
||||
})
|
||||
};
|
||||
|
||||
export default Carousel;
|
||||
@@ -2,24 +2,20 @@
|
||||
|
||||
import Preview from '@/components/Movie/Preview';
|
||||
|
||||
import { Carousel, Measurer } from './components/Carousel';
|
||||
import Carousel from './components/Carousel';
|
||||
import useRandomMovie from './useRandomMovie';
|
||||
|
||||
export default function Container() {
|
||||
const { movies, movie, index, onIndexChange } = useRandomMovie();
|
||||
|
||||
return (
|
||||
<Measurer>
|
||||
{(width) => (
|
||||
<>
|
||||
<Preview
|
||||
movie={movie}
|
||||
className='bg-background rounded-md'
|
||||
card={<Carousel index={index} width={width} movies={movies} onIndexChange={onIndexChange} />}
|
||||
card={<Carousel index={index} movies={movies} onIndexChange={onIndexChange} />}
|
||||
/>
|
||||
<div className='w-full h-2' />
|
||||
</>
|
||||
)}
|
||||
</Measurer>
|
||||
);
|
||||
}
|
||||
@@ -1,27 +1,24 @@
|
||||
'use client';
|
||||
|
||||
import { startTransition, useCallback, useEffect, useState } from 'react';
|
||||
import { startTransition, useCallback, useState } from 'react';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
|
||||
import useFilters from '@/app/(site)/useFilters';
|
||||
import { randomMovies } from '@/lib/api';
|
||||
|
||||
const UPDATE_RATE = 10;
|
||||
|
||||
const previousIndexes: Record<string, number> = {};
|
||||
let previousIndex: number = 0;
|
||||
|
||||
const useRandomMovie = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const { filters } = useFilters();
|
||||
const indexByFilter = previousIndexes[JSON.stringify(filters)];
|
||||
const [index, setIndex] = useState(indexByFilter);
|
||||
const [index, setIndex] = useState(previousIndex);
|
||||
|
||||
const { data: movies, refetch } = useQuery({
|
||||
queryKey: ['random-movie', filters],
|
||||
queryFn: () => randomMovies({ filters }),
|
||||
queryKey: ['random-movie'],
|
||||
queryFn: () => randomMovies({ filters: {} }),
|
||||
structuralSharing(_, newData) {
|
||||
const uniqueIds: Record<string, number> = {};
|
||||
const current = queryClient.getQueryData<Movie[]>(['random-movie', filters]) || [];
|
||||
const current = queryClient.getQueryData<Movie[]>(['random-movie']) || [];
|
||||
const next = Array.isArray(newData) ? newData : [newData];
|
||||
|
||||
return [...current, ...next].reduce((unique, movie) => {
|
||||
@@ -35,10 +32,6 @@ const useRandomMovie = () => {
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setIndex(indexByFilter || 0);
|
||||
}, [indexByFilter]);
|
||||
|
||||
return {
|
||||
movies,
|
||||
movie: movies?.[index],
|
||||
@@ -48,10 +41,10 @@ const useRandomMovie = () => {
|
||||
if ((index && index % UPDATE_RATE === 0) || movies!.length < UPDATE_RATE) {
|
||||
refetch();
|
||||
}
|
||||
previousIndexes[JSON.stringify(filters)] = index;
|
||||
previousIndex = index;
|
||||
startTransition(() => setIndex(index));
|
||||
},
|
||||
[movies, filters]
|
||||
[movies]
|
||||
),
|
||||
index
|
||||
};
|
||||
|
||||
+9
-3
@@ -1,8 +1,12 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import type { Metadata, Viewport } from 'next';
|
||||
import { Poppins } from 'next/font/google';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
const poppins = Poppins({ subsets: ['latin'], weight: '400' });
|
||||
|
||||
import Header from '@/components/Header';
|
||||
import { cn } from '@/lib/utils';
|
||||
import Providers from '@/providers';
|
||||
|
||||
import '@/styles/index.css';
|
||||
@@ -28,16 +32,18 @@ export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
<html lang='en' className={theme}>
|
||||
<head>
|
||||
<meta name='theme-color' content='black' />
|
||||
<link rel='preconnect' href='https://fonts.googleapis.com' />
|
||||
{/* <link rel='preconnect' href='https://fonts.googleapis.com' />
|
||||
<link rel='preconnect' href='https://fonts.gstatic.com' crossOrigin='' />
|
||||
<link href='https://fonts.googleapis.com/css2?family=Moderustic&family=Poppins&display=swap' rel='stylesheet' />
|
||||
<link href='https://fonts.googleapis.com/css2?family=Moderustic&family=Poppins&display=swap' rel='stylesheet' /> */}
|
||||
</head>
|
||||
<body>
|
||||
<Providers theme={theme}>
|
||||
<div className='sticky top-0 z-20'>
|
||||
<Header />
|
||||
</div>
|
||||
<main className='px-2 max-w-[1240px] mx-auto'>{children}</main>
|
||||
<main className='px-2 max-w-[1240px] mx-auto' style={poppins.style}>
|
||||
{children}
|
||||
</main>
|
||||
</Providers>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -21,7 +21,7 @@ export function MobileNavigation() {
|
||||
const currentPath = usePathname();
|
||||
|
||||
return (
|
||||
<div className='flex xs:hidden'>
|
||||
<div className='flex md:hidden'>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant='ghost' size='icon'>
|
||||
@@ -58,7 +58,7 @@ export function DesktopNavigation() {
|
||||
}, [currentPath]);
|
||||
|
||||
return (
|
||||
<ul className='relative hidden xs:flex items-center whitespace-nowrap text-sm gap-3'>
|
||||
<ul className='relative hidden md:flex items-center whitespace-nowrap text-sm gap-3'>
|
||||
{paths.map(({ path, title }) => (
|
||||
<li
|
||||
key={path}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { FC } from 'react';
|
||||
|
||||
import Poster from '@/components/Movie/components/Poster';
|
||||
import Rating from '@/components/Movie/components/Rating';
|
||||
import { AspectRatio } from '@/components/ui/aspect-ratio';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
import Favorite from './components/Favorite';
|
||||
@@ -12,17 +11,17 @@ interface Props {
|
||||
movie?: Movie;
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
containerProps?: unknown;
|
||||
}
|
||||
|
||||
const Card: FC<Props> = ({ movie, onClick, className }) => {
|
||||
const Card: FC<Props> = ({ movie, onClick, className, containerProps }) => {
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
<div className='xs:w-[300px] xs:h-[450px] w-full h-full shrink-0'>
|
||||
<AspectRatio ratio={2 / 3}>
|
||||
<div
|
||||
{...(containerProps || {})}
|
||||
className={cn(
|
||||
'h-full relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg',
|
||||
'card-aspect-ratio relative bg-card text-card-foreground shadow-sm transition-shadow hover:shadow-lg overflow-hidden rounded-lg',
|
||||
className
|
||||
)}
|
||||
>
|
||||
@@ -43,8 +42,6 @@ const Card: FC<Props> = ({ movie, onClick, className }) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AspectRatio>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,14 +49,12 @@ const List: FC<Props> = ({ pages, hasNextPage, fetchNextPage, onPreviewClose, ty
|
||||
<>
|
||||
<VirtuosoGrid
|
||||
useWindowScroll
|
||||
listClassName='flex gap-2 flex-wrap justify-center grow empty:hidden opacity-0 animate-fade-in-slide-in'
|
||||
customScrollParent={customScrollParent}
|
||||
totalCount={shows.length}
|
||||
overscan={4}
|
||||
endReached={handleFetchMore}
|
||||
data={shows}
|
||||
context={context}
|
||||
components={components}
|
||||
listClassName='flex gap-2 flex-wrap justify-center grow empty:hidden opacity-0 animate-fade-in-slide-in'
|
||||
customScrollParent={customScrollParent}
|
||||
endReached={handleFetchMore}
|
||||
/>
|
||||
<div className='h-2 w-full' />
|
||||
</>
|
||||
|
||||
@@ -25,8 +25,7 @@ const Preview: FC<Props> = ({ movie, className, onClose, children, card, type =
|
||||
if (!movie) return null;
|
||||
|
||||
return (
|
||||
<div className={cn('rounded-xl text-card-foreground', { 'p-2': Boolean(onClose) }, className)}>
|
||||
<div className='flex flex-col md:flex-row max-w-[100%] gap-2'>
|
||||
<div className={cn('flex flex-col md:flex-row gap-2 rounded-xl', { 'p-2': Boolean(onClose) }, className)}>
|
||||
{card || <Card className='mx-auto' movie={movie} />}
|
||||
<div className='flex flex-col grow'>
|
||||
{children && <div className='flex hover-none:hidden w-full max-sm:mb-0 mb-2 gap-2'>{children}</div>}
|
||||
@@ -42,7 +41,6 @@ const Preview: FC<Props> = ({ movie, className, onClose, children, card, type =
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,10 +17,11 @@ const Trailer: FC<{ trailerKey?: string } & InstanceProps<void>> = ({ trailerKey
|
||||
if (!trailerKey) return;
|
||||
|
||||
return (
|
||||
<Modal className='block p-0 min-h-[400px] border-none aspect-w-16 aspect-h-9' onClose={onResolve}>
|
||||
<Modal className='block p-0 min-h-[400px] border-none' style={{ aspectRatio: '16/9' }} onClose={onResolve}>
|
||||
<iframe
|
||||
allow='autoplay'
|
||||
className='border-none rounded-lg'
|
||||
style={{ aspectRatio: '16/9' }}
|
||||
width='100%'
|
||||
height='100%'
|
||||
src={`//www.youtube.com/embed/${trailerKey}?autoplay=1`}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio';
|
||||
|
||||
const AspectRatio = AspectRatioPrimitive.Root;
|
||||
|
||||
export { AspectRatio };
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { useState } from 'react';
|
||||
import { CSSProperties, useState } from 'react';
|
||||
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
||||
|
||||
import useScrollDelta from '@/hooks/useScrollDelta';
|
||||
@@ -157,9 +157,10 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
||||
const Modal: React.FC<{
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
style?: CSSProperties;
|
||||
onClose: () => void;
|
||||
scrollRef?: React.MutableRefObject<HTMLDivElement>;
|
||||
}> = ({ children, onClose, className, scrollRef }) => {
|
||||
}> = ({ children, onClose, className, style, scrollRef }) => {
|
||||
const [open, setOpen] = useState(true);
|
||||
|
||||
const handleClose = () => {
|
||||
@@ -172,7 +173,7 @@ const Modal: React.FC<{
|
||||
<DialogHeader>
|
||||
<DialogTitle />
|
||||
</DialogHeader>
|
||||
<DialogContent scrollRef={scrollRef} forceMount onClose={handleClose} className={className}>
|
||||
<DialogContent style={style} scrollRef={scrollRef} forceMount onClose={handleClose} className={className}>
|
||||
{children}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Generated
-141
@@ -8,7 +8,6 @@
|
||||
"name": "movie-advisor",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
||||
"@radix-ui/react-dialog": "^1.1.1",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-hover-card": "^1.0.7",
|
||||
@@ -42,7 +41,6 @@
|
||||
"node-html-parser": "^6.1.5",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-fast-marquee": "^1.6.0",
|
||||
"react-modal-promise": "^1.0.2",
|
||||
"react-virtuoso": "^4.10.1",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
@@ -51,7 +49,6 @@
|
||||
"vaul": "^0.8.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/aspect-ratio": "^0.4.2",
|
||||
"@types/js-cookie": "^3.0.3",
|
||||
"@types/node": "20.4.4",
|
||||
"@types/react": "18.2.15",
|
||||
@@ -590,81 +587,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-aspect-ratio": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-aspect-ratio/-/react-aspect-ratio-1.1.0.tgz",
|
||||
"integrity": "sha512-dP87DM/Y7jFlPgUZTlhx6FF5CEzOiaxp2rBCKlaXlpH5Ip/9Fg5zZ9lDOQ5o/MOfUlf36eak14zoWYpgcgGoOg==",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-primitive": "2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-aspect-ratio/node_modules/@radix-ui/react-compose-refs": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz",
|
||||
"integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-aspect-ratio/node_modules/@radix-ui/react-primitive": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz",
|
||||
"integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-slot": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"@types/react-dom": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-aspect-ratio/node_modules/@radix-ui/react-slot": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz",
|
||||
"integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": "1.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@radix-ui/react-collection": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz",
|
||||
@@ -2252,15 +2174,6 @@
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/aspect-ratio": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/aspect-ratio/-/aspect-ratio-0.4.2.tgz",
|
||||
"integrity": "sha512-8QPrypskfBa7QIMuKHg2TA7BqES6vhBrDLOv8Unb6FcFyd3TjKbc6lcmb9UPQHxfl24sXoJ41ux/H7qQQvfaSQ==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"tailwindcss": ">=2.0.0 || >=3.0.0 || >=3.0.0-alpha.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/query-core": {
|
||||
"version": "5.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.28.4.tgz",
|
||||
@@ -6084,15 +5997,6 @@
|
||||
"react": "^18.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-fast-marquee": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/react-fast-marquee/-/react-fast-marquee-1.6.0.tgz",
|
||||
"integrity": "sha512-jtuwT9SNjrqxnE7lGZ8mTL1I8Q4+9G4aBta2p+y2Pa3SjR17QROblwrLICyM8rbjQFHgHawTHcaH9HvoVO2NOA==",
|
||||
"peerDependencies": {
|
||||
"react": ">= 16.8.0 || 18.0.0",
|
||||
"react-dom": ">= 16.8.0 || 18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
@@ -7739,38 +7643,6 @@
|
||||
"@radix-ui/react-primitive": "1.0.3"
|
||||
}
|
||||
},
|
||||
"@radix-ui/react-aspect-ratio": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-aspect-ratio/-/react-aspect-ratio-1.1.0.tgz",
|
||||
"integrity": "sha512-dP87DM/Y7jFlPgUZTlhx6FF5CEzOiaxp2rBCKlaXlpH5Ip/9Fg5zZ9lDOQ5o/MOfUlf36eak14zoWYpgcgGoOg==",
|
||||
"requires": {
|
||||
"@radix-ui/react-primitive": "2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-compose-refs": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.0.tgz",
|
||||
"integrity": "sha512-b4inOtiaOnYf9KWyO3jAeeCG6FeyfY6ldiEPanbUjWd+xIk5wZeHa8yVwmrJ2vderhu/BQvzCrJI0lHd+wIiqw==",
|
||||
"requires": {}
|
||||
},
|
||||
"@radix-ui/react-primitive": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.0.tgz",
|
||||
"integrity": "sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==",
|
||||
"requires": {
|
||||
"@radix-ui/react-slot": "1.1.0"
|
||||
}
|
||||
},
|
||||
"@radix-ui/react-slot": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.0.tgz",
|
||||
"integrity": "sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==",
|
||||
"requires": {
|
||||
"@radix-ui/react-compose-refs": "1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@radix-ui/react-collection": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.0.3.tgz",
|
||||
@@ -8587,13 +8459,6 @@
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"@tailwindcss/aspect-ratio": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/aspect-ratio/-/aspect-ratio-0.4.2.tgz",
|
||||
"integrity": "sha512-8QPrypskfBa7QIMuKHg2TA7BqES6vhBrDLOv8Unb6FcFyd3TjKbc6lcmb9UPQHxfl24sXoJ41ux/H7qQQvfaSQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"@tanstack/query-core": {
|
||||
"version": "5.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.28.4.tgz",
|
||||
@@ -11193,12 +11058,6 @@
|
||||
"scheduler": "^0.23.2"
|
||||
}
|
||||
},
|
||||
"react-fast-marquee": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/react-fast-marquee/-/react-fast-marquee-1.6.0.tgz",
|
||||
"integrity": "sha512-jtuwT9SNjrqxnE7lGZ8mTL1I8Q4+9G4aBta2p+y2Pa3SjR17QROblwrLICyM8rbjQFHgHawTHcaH9HvoVO2NOA==",
|
||||
"requires": {}
|
||||
},
|
||||
"react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-aspect-ratio": "^1.1.0",
|
||||
"@radix-ui/react-dialog": "^1.1.1",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
||||
"@radix-ui/react-hover-card": "^1.0.7",
|
||||
@@ -43,7 +42,6 @@
|
||||
"node-html-parser": "^6.1.5",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-fast-marquee": "^1.6.0",
|
||||
"react-modal-promise": "^1.0.2",
|
||||
"react-virtuoso": "^4.10.1",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
@@ -52,7 +50,6 @@
|
||||
"vaul": "^0.8.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/aspect-ratio": "^0.4.2",
|
||||
"@types/js-cookie": "^3.0.3",
|
||||
"@types/node": "20.4.4",
|
||||
"@types/react": "18.2.15",
|
||||
|
||||
+28
-9
@@ -92,15 +92,15 @@
|
||||
* {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
font-family: 'Poppins', sans-serif;
|
||||
font-optical-sizing: auto;
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
color: white;
|
||||
background: black;
|
||||
}
|
||||
::selection {
|
||||
color: white;
|
||||
background: black;
|
||||
}
|
||||
|
||||
.card-gradient {
|
||||
@@ -139,3 +139,22 @@
|
||||
rgba(0, 0, 0, 0.4) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.card-aspect-ratio {
|
||||
width: 300px;
|
||||
height: 450px;
|
||||
flex-shrink: 0;
|
||||
@media screen and (max-width: 500px) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
aspect-ratio: 2/3;
|
||||
}
|
||||
}
|
||||
|
||||
@supports (hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none) {
|
||||
.card-aspect-ratio {
|
||||
@media screen and (max-width: 500px) {
|
||||
aspect-ratio: 2/2.908;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -83,5 +83,5 @@ module.exports = {
|
||||
corePlugins: {
|
||||
aspectRatio: false
|
||||
},
|
||||
plugins: [require('tailwindcss-animate'), require('@tailwindcss/aspect-ratio'), require('tailwindcss-touch')()]
|
||||
plugins: [require('tailwindcss-animate'), require('tailwindcss-touch')()]
|
||||
};
|
||||
Reference in new issue
Block a user