This commit is contained in:
amirhosein.ashourloo
2026-08-10 13:07:14 +03:30
parent 95c3c74276
commit c4e8a54623
15 changed files with 341 additions and 58 deletions
+8 -3
View File
@@ -5,10 +5,16 @@ import Link from "next/link";
import { useCallback, useEffect, useRef, useState } from "react";
import { Reveal } from "@/components/Reveal";
import type { NewsItem } from "@/data/site";
import type { DisplayNewsItem } from "@/lib/api";
/** Horizontal snap-scroll rail of news/blog cards, matching the site's other carousels. */
export function NewsCarousel({ items, basePath }: { items: NewsItem[]; basePath: string }) {
export function NewsCarousel({
items,
basePath,
}: {
items: DisplayNewsItem[];
basePath: string;
}) {
const trackRef = useRef<HTMLUListElement>(null);
const [atStart, setAtStart] = useState(true);
const [atEnd, setAtEnd] = useState(false);
@@ -92,7 +98,6 @@ export function NewsCarousel({ items, basePath }: { items: NewsItem[]; basePath:
fill
quality={80}
sizes="(max-width: 640px) 82vw, (max-width: 1024px) 52vw, 26rem"
placeholder="blur"
loading={i < 2 ? "eager" : "lazy"}
className="object-cover transition-transform duration-[1100ms] ease-out-soft group-hover:scale-[1.06]"
/>