diff --git a/app/(site)/(root)/components/Carousel/index.tsx b/app/(site)/(root)/components/Carousel/index.tsx index f60d368..77934c3 100644 --- a/app/(site)/(root)/components/Carousel/index.tsx +++ b/app/(site)/(root)/components/Carousel/index.tsx @@ -21,31 +21,27 @@ interface Props extends Context { const Carousel = memo( function Carousel({ shows, gap = 8, onIndexChange, onEndReached }: Props) { - const initialRef = useRef(true); const index = useSilentIndex(); const [loaded, setLoaded] = useState(!index); const context = useMemo( () => ({ - onIndexChange, + onIndexChange: (next: number) => { + onIndexChange(next); + + if (loaded || next === index) return; + + startTransition(() => setLoaded(true)); + }, gap }), - [onIndexChange, gap] + [onIndexChange, gap, loaded, index] ); - const handleScroll = () => { - if (loaded) return; - - if (initialRef.current) return (initialRef.current = false); - - startTransition(() => setLoaded(true)); - }; - return (
{!loaded && } = ({ show, onClick, className, lazy = true }) => ( -
-
- - - - - - {show.title} - -
-
- -
+
+ + + + + + {show.title} + +
); diff --git a/components/Preview/index.tsx b/components/Preview/index.tsx index 684ad65..64bbbc6 100644 --- a/components/Preview/index.tsx +++ b/components/Preview/index.tsx @@ -57,7 +57,7 @@ const Preview: FC = ({ show: baseShow, showType, showId, className, poste )}
- +

{show.overview} diff --git a/styles/index.css b/styles/index.css index 2a88300..dddac70 100644 --- a/styles/index.css +++ b/styles/index.css @@ -136,17 +136,9 @@ height: 450px; flex-shrink: 0; @media screen and (max-width: 600px) { - 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: 600px) { - aspect-ratio: 1.35/2; - } + --width: calc(100vw - 1rem); + width: var(--width); + height: calc(var(--width) * 3 / 2); } } }