import { useState } from "react";
import { Button, Textarea } from '@peppermint-design/devreadykit';
export default function CommentInput() {
const [comment, setComment] = useState("");
const [comments, setComments] = useState<string[]>([]);
const handlePost = () => {
if (!comment.trim()) return;
setComments((prev) => [comment.trim(), ...prev]);
setComment("");
};
return (
<div className="space-y-4">
<Textarea
value={comment}
onValueChange={setComment}
placeholder="Write a comment..."
autoGrow
minRows={2}
action={
<Button
size="s"
variant="filled"
disabled={!comment.trim()}
onClick={handlePost}
>
Post
</Button>
}
/>
<div className="space-y-2">
{comments.map((entry, index) => (
<div key={`${entry}-${index}`} className="p-2 border rounded">
{entry}
</div>
))}
</div>
</div>
);
}