import { ThumbsUp, X } from "lucide-react"; import { useState } from "react"; import type { Comment, User } from "../types"; import { formatRelativeTime, formatAbsoluteUTC } from "../utils"; import { CommentText } from "./CommentText"; interface CommentListProps { author: User; createdAt: string | Date; comments: Comment[]; } export function CommentList({ author, createdAt, comments }: CommentListProps) { const [previewImage, setPreviewImage] = useState(null); return ( <>
{author.avatar_url ? ( avatar ) : null}
{author.nickname}
发布于 {formatRelativeTime(createdAt)}
{/* 图片预览灯箱 */} {previewImage && (
setPreviewImage(null)} > {/* 关闭按钮 */} {/* 大图 */} preview e.stopPropagation()} />
)} ); }