diff --git a/apps/web/src/components/models/post/LetterCard.tsx b/apps/web/src/components/models/post/LetterCard.tsx index 0c9e6a9..048d307 100644 --- a/apps/web/src/components/models/post/LetterCard.tsx +++ b/apps/web/src/components/models/post/LetterCard.tsx @@ -48,7 +48,7 @@ export function LetterCard({ letter }: LetterCardProps) {
)} diff --git a/apps/web/src/components/models/post/detail/PostCommentList.tsx b/apps/web/src/components/models/post/detail/PostCommentList.tsx index 2257f58..22486a7 100644 --- a/apps/web/src/components/models/post/detail/PostCommentList.tsx +++ b/apps/web/src/components/models/post/detail/PostCommentList.tsx @@ -150,12 +150,6 @@ export default function PostCommentList() { animate={{ opacity: 1, y: 0 }} className="text-center py-12 text-slate-500"> 暂无回复,来发表第一条回复吧 - ); } diff --git a/apps/web/src/components/models/post/detail/PostHeader/Content.tsx b/apps/web/src/components/models/post/detail/PostHeader/Content.tsx index b9f3da5..0a0bd44 100644 --- a/apps/web/src/components/models/post/detail/PostHeader/Content.tsx +++ b/apps/web/src/components/models/post/detail/PostHeader/Content.tsx @@ -1,4 +1,5 @@ import { useContext } from "react"; +import { useState, useRef, useEffect } from "react"; import { PostDetailContext } from "../context/PostDetailContext"; import { motion } from "framer-motion"; @@ -7,29 +8,45 @@ import { StatsSection } from "./StatsSection"; import PostResources from "../PostResources"; export default function Content() { const { post, user } = useContext(PostDetailContext); + const [isExpanded, setIsExpanded] = useState(false); + const contentRef = useRef(null); + const [shouldCollapse, setShouldCollapse] = useState(false); + useEffect(() => { + if (contentRef.current) { + const shouldCollapse = contentRef.current.scrollHeight > 300; // 300px threshold + setShouldCollapse(shouldCollapse); + } + }, [post?.content]); return ( -