"use client"; import Link from "next/link"; import gsap from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; import type { PublicPost } from "@/lib/store"; import { formatDate, readingTimeLabel } from "@/lib/utils"; import { useGsapAnimation } from "./useGsapAnimation"; gsap.registerPlugin(ScrollTrigger); function FeaturedCard({ post }: { post: PublicPost }) { return (
{post.category}

{post.title}

{post.excerpt}

{readingTimeLabel(post.readingTime)}
); } export function FeaturedGrid({ posts }: { posts: PublicPost[] }) { const ref = useGsapAnimation((_, isReduced) => { if (isReduced || posts.length === 0) return; gsap.from(".featured-card", { y: 50, opacity: 0, duration: 0.8, stagger: 0.15, ease: "power3.out", scrollTrigger: { trigger: ref.current, start: "top 85%" }, }); }, [posts.length]); if (posts.length === 0) return null; return (
} className="px-page max-w-5xl mx-auto pb-16">
{posts.map((post) => ( ))}
); } export function RecentList({ posts }: { posts: PublicPost[] }) { const ref = useGsapAnimation((_, isReduced) => { if (isReduced || posts.length === 0) return; gsap.from(".recent-item", { y: 30, opacity: 0, duration: 0.6, stagger: 0.08, ease: "power3.out", scrollTrigger: { trigger: ref.current, start: "top 85%" }, }); }, [posts.length]); if (posts.length === 0) return null; return (
} className="px-page max-w-5xl mx-auto pb-24">
最新文章
{posts.map((post) => (

{post.title}

{post.excerpt}

{post.category}
))}
查看全部文章
); }