feat: 添加评论功能,包括评论输入、评论列表和评论项组件,支持层级深度和私密评论

This commit is contained in:
2025-07-31 08:03:19 +08:00
parent 92c2a58e80
commit 94aa4f1b1f
23 changed files with 303 additions and 53 deletions

View File

@ -2,7 +2,6 @@
import React from "react";
import { toast } from "sonner";
// 更安全的类型声明
function extractText(node: React.ReactNode): string {
if (typeof node === "string") return node;
if (Array.isArray(node)) return node.map(extractText).join("");
@ -71,7 +70,13 @@ export default function CodeBlock(props: React.ComponentPropsWithoutRef<"pre">)
{language}
</span>
)}
<div className="absolute right-3 top-1/2 -translate-y-1/2 flex space-x-2 opacity-0 group-hover:opacity-100 transition-opacity">
<div
className="absolute right-3 top-1/2 -translate-y-1/2 flex space-x-2
opacity-100
group-hover:opacity-100
sm:opacity-0 sm:group-hover:opacity-100
transition-opacity"
>
<button
type="button"
className="px-2 py-1 rounded text-xs bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600"