import { FormEvent, useState } from 'react' type Props = { onSubmit: (message: string) => void busy: boolean } export function PromptBar({ onSubmit, busy }: Props) { const [text, setText] = useState('') const handle = (e: FormEvent) => { e.preventDefault() if (!text.trim() || busy) return onSubmit(text.trim()) setText('') } return (
) }