"use client"; import { useRef } from "react"; import Link from "next/link"; import { ChevronLeft, ChevronRight } from "lucide-react"; import { Container } from "@/components/Container"; import { Placeholder } from "@/components/Placeholder"; import { blogHref, blogImage, type BlogPost } from "@/lib/blog"; import { formatFaDate } from "@/lib/format"; type LocalPost = { slug: string; title: string; excerpt: string; date: string; image: string; }; export function BlogCarousel({ posts = [], fallback = [], }: { posts?: BlogPost[]; fallback?: LocalPost[]; }) { const scroller = useRef(null); const usingApi = posts.length > 0; const scrollByCard = (direction: number) => { const node = scroller.current; if (!node) return; const card = node.querySelector("article"); const amount = card ? card.getBoundingClientRect().width + 20 : 340; node.scrollBy({ left: direction * amount, behavior: "smooth" }); }; return (

Blog

آخرین مقالات

مشاهده همه

نکته‌هایی از تعمیرگاه و بورس قطعات — برای مصرف‌کننده و همکار.

{usingApi ? posts.map((post) => (

{formatFaDate(post.publishedAt || post.createdAt)}

{post.title}

{post.abstract ? (

{post.abstract}

) : null}
)) : fallback.map((post) => (

{post.date}

{post.title}

{post.excerpt}

))}
); }