({ placeholder, onSubmit, autoFocus })
| 3 | const { TextArea } = Input; |
| 4 | |
| 5 | export default function CommentInput({ placeholder, onSubmit, autoFocus }) { |
| 6 | const handleSubmit = () => { |
| 7 | onSubmit?.(text); |
| 8 | setText(''); |
| 9 | } |
| 10 | |
| 11 | const [text, setText] = useState(''); |
| 12 | |
| 13 | return <Space direction="vertical" style={{ width: "100%" }}> |
| 14 | <TextArea autoFocus={autoFocus} placeholder={placeholder} |
| 15 | value={text} |
| 16 | onChange={e => setText(e.target.value)} |
| 17 | /> |
| 18 | <Row justify="end"> |
| 19 | <Col><Button type="primary" onClick={handleSubmit}>发布</Button></Col> |
| 20 | </Row> |
| 21 | </Space> |
| 22 | } |
nothing calls this directly
no outgoing calls
no test coverage detected