"use client"; import Link from "next/link"; import { motion, useReducedMotion } from "motion/react"; import { ArrowLeft, ArrowUpRight, Calendar, Clock, Sparkles, ChevronLeft, ChevronRight } from "lucide-react"; import { useState } from "react"; import type { LifePost } from "@/content/life/types"; import { BackToTopButton } from "@/components/back-to-top-button"; type LifeArticlePageProps = { post: LifePost; prevPost?: LifePost; nextPost?: LifePost; }; export function LifeArticlePage({ post, prevPost, nextPost }: LifeArticlePageProps) { const reduceMotion = useReducedMotion(); const distance = reduceMotion ? 0 : 24; const duration = reduceMotion ? 0 : 0.55; const easeOut = [0.22, 1, 0.36, 1] as const; const [currentImageIndex, setCurrentImageIndex] = useState(0); const container = { hidden: {}, show: { transition: { staggerChildren: reduceMotion ? 0 : 0.08, delayChildren: reduceMotion ? 0 : 0.1, }, }, }; const reveal = { hidden: { opacity: 0, y: distance, filter: reduceMotion ? "none" : "blur(8px)" }, show: { opacity: 1, y: 0, filter: "blur(0px)", transition: { duration, ease: easeOut } }, }; const scaleReveal = { hidden: { opacity: 0, y: distance, scale: reduceMotion ? 1 : 0.97 }, show: { opacity: 1, y: 0, scale: 1, transition: { duration, ease: easeOut } }, }; const nextImage = () => { if (post.images.length > 0) { setCurrentImageIndex((prev) => (prev + 1) % post.images.length); } }; const prevImage = () => { if (post.images.length > 0) { setCurrentImageIndex((prev) => (prev - 1 + post.images.length) % post.images.length); } }; return (
{/* 背景装饰 */}
{/* 顶部导航 */} 返回列表 fly {/* 文章内容 */}
{/* 文章头部 */}
{post.date} 约 {Math.ceil(post.paragraphs.length * 0.8)} 分钟阅读

{post.title}

{post.description}

{/* 图片画廊 */} {post.images && post.images.length > 0 && (
{/* 主图片 */}
{post.images[currentImageIndex]?.alt} {/* 图片渐变遮罩 */}
{/* 图片切换按钮 */} {post.images.length > 1 && ( <> )} {/* 图片计数 */} {post.images.length > 1 && (
{currentImageIndex + 1} / {post.images.length}
)}
{/* 图片说明 */}

{post.images[currentImageIndex]?.caption}

{post.images.length > 1 && (
{post.images.map((_, index) => (
)}
)} {/* 正文内容 */} {post.paragraphs.map((paragraph, index) => (

{paragraph}

))}
{/* 文章结尾装饰 */}
end
{/* 上一篇/下一篇导航 */} 继续阅读
{prevPost ? (

← 上一篇

{prevPost.title}

{prevPost.description}

) : (
)} {nextPost ? (

下一篇 →

{nextPost.title}

{nextPost.description}

) : (
)}
{/* 页脚 */} fly / life made with ♥
); }