This commit is contained in:
Shusui MOYATANI
2023-03-01 00:31:04 +09:00
parent 57bc321436
commit 471b03eb1d
20 changed files with 279 additions and 118 deletions

View File

@@ -8,14 +8,17 @@ type NotePostFormProps = {
const NotePostForm: Component<NotePostFormProps> = (props) => {
const [text, setText] = createSignal<string>('');
const clearText = () => setText('');
const handleChangeText: JSX.EventHandler<HTMLTextAreaElement, Event> = (ev) => {
setText(ev.currentTarget.value);
};
const handleSubmit: JSX.EventHandler<HTMLFormElement, Event> = (ev) => {
ev.preventDefault();
// TODO 投稿完了したかどうかの検知をしたい
props.onPost({ content: text() });
// TODO 投稿完了したらなんかする
clearText();
};
const submitDisabled = createMemo(() => text().trim().length === 0);