From e23feb3c2317910fc2939a0403b9afd3399a9e87 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 14 Nov 2025 16:15:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EventCommentSection/CommentInput.js | 77 +++++++ .../EventCommentSection/CommentItem.js | 89 ++++++++ .../EventCommentSection/CommentList.js | 67 ++++++ .../EventCommentSection.js | 194 ++++++++++++++++++ src/components/EventCommentSection/index.js | 10 + src/mocks/handlers/event.js | 178 ++++++++++++++++ .../DynamicNewsDetailPanel.js | 7 + .../components/EventCard/KeywordsCarousel.js | 4 +- 8 files changed, 625 insertions(+), 1 deletion(-) create mode 100644 src/components/EventCommentSection/CommentInput.js create mode 100644 src/components/EventCommentSection/CommentItem.js create mode 100644 src/components/EventCommentSection/CommentList.js create mode 100644 src/components/EventCommentSection/EventCommentSection.js create mode 100644 src/components/EventCommentSection/index.js diff --git a/src/components/EventCommentSection/CommentInput.js b/src/components/EventCommentSection/CommentInput.js new file mode 100644 index 00000000..0f5d9009 --- /dev/null +++ b/src/components/EventCommentSection/CommentInput.js @@ -0,0 +1,77 @@ +// src/components/EventCommentSection/CommentInput.js +/** + * 评论输入框组件 + * 功能:输入评论内容、字数限制、发布按钮 + */ + +import React from 'react'; +import { + Box, + Textarea, + Button, + HStack, + Text, + useColorModeValue, +} from '@chakra-ui/react'; + +const CommentInput = ({ + value, + onChange, + onSubmit, + isSubmitting, + maxLength = 500, + placeholder = '说点什么...', +}) => { + const bgColor = useColorModeValue('white', 'gray.800'); + const borderColor = useColorModeValue('gray.200', 'gray.600'); + const textColor = useColorModeValue('gray.600', 'gray.400'); + const countColor = useColorModeValue('gray.500', 'gray.500'); + + const handleKeyDown = (e) => { + // Ctrl/Cmd + Enter 快捷键提交 + if ((e.ctrlKey || e.metaKey) && e.key === 'Enter') { + onSubmit(); + } + }; + + return ( + +