import React, { useState } from 'react' export default function CommentForm({ placeholder = 'Write a comment…', submitLabel = 'Post', onSubmit, onCancel, compact = false }) { const [content, setContent] = useState('') const [busy, setBusy] = useState(false) const [error, setError] = useState('') const handleSubmit = async (event) => { event.preventDefault() const trimmed = content.trim() if (!trimmed || busy) return setBusy(true) setError('') try { await onSubmit?.(trimmed) setContent('') } catch (submitError) { setError(submitError?.message || 'Unable to post comment.') } finally { setBusy(false) } } return (