From c428dc50defc85ed9a484f0d068ca2215cc9bef5 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 29 Jun 2023 22:55:16 +0100 Subject: [PATCH] fix: comment list height in post modal --- src/components/common/Comment.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/common/Comment.tsx b/src/components/common/Comment.tsx index 90428864..6b8a7864 100644 --- a/src/components/common/Comment.tsx +++ b/src/components/common/Comment.tsx @@ -1,5 +1,6 @@ "use client" +import { useState } from "react" // TODO import { Virtuoso } from "react-virtuoso" @@ -29,6 +30,8 @@ const Comment = ({ (page) => (page?.list?.length ?? 0) > 0, ) + const [totalListHeight, setTotalListHeight] = useState(1) + return (
{ + if (fixHeight && height > 0) { + setTotalListHeight(Math.min(height + 71, 900)) + } + }} itemContent={(_, p) => p?.list?.map((comment, idx) => (