| import React, { useState } from 'react'; |
| import './CommentForm.css'; |
| const CommentForm = ({ onSubmit, onCancel }) => { |
| const [content, setContent] = useState(''); |
| const [isFocused, setIsFocused] = useState(false); |
| const handleSubmit = (e) => { |
| <div className="comment-form-container"> |
| <form className="comment-form" onSubmit={handleSubmit}> |
| <div className={`form-group ${isFocused ? 'focused' : ''}`}> |
| className="comment-input" |
| onChange={(e) => setContent(e.target.value)} |
| onFocus={() => setIsFocused(true)} |
| onBlur={() => setIsFocused(false)} |
| <div className="floating-label">添加评论</div> |
| <div className="form-actions"> |
| className="cancel-button" |
| className="submit-button" |
| disabled={!content.trim()} |
| export default CommentForm; |