import * as React from "react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@godxjp/ui/data-display"; import { FormField, Textarea } from "@godxjp/ui/data-entry"; import { Button } from "@godxjp/ui/general"; import { Flex, PageContainer } from "@godxjp/ui/layout"; /** * Textarea — styled wrapper around the native textarea. Pair with FormField for * a labelled field. Composed only from real @godxjp/ui components. */ type Message = { id: number; author: string; body: string }; const SEED_MESSAGES: Message[] = [ { id: 1, author: "佐藤", body: "月次の締め、明日の10時までにお願いします。" }, { id: 2, author: "Trần", body: "承知しました。INV-2024-0312 の差異だけ確認中です。" }, ]; /** * The godx-chatter composer. One line at rest, grows line by line, scrolls itself past * eight rows, and collapses back to one line the moment the post is sent — the send button just * resets the controlled value, and `autoGrow` follows it without a single line of layout code. */ function Composer() { const [messages, setMessages] = React.useState(SEED_MESSAGES); const [draft, setDraft] = React.useState(""); const send = () => { const body = draft.trim(); if (!body) return; setMessages((current) => [...current, { id: current.length + 1, author: "自分", body }]); setDraft(""); }; return ( {messages.map((message) => ( {message.author} {message.body} ))}