diff options
Diffstat (limited to 'ui/lib/components/CreateConversationForm.svelte')
| -rw-r--r-- | ui/lib/components/CreateConversationForm.svelte | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/lib/components/CreateConversationForm.svelte b/ui/lib/components/CreateConversationForm.svelte new file mode 100644 index 0000000..e390a78 --- /dev/null +++ b/ui/lib/components/CreateConversationForm.svelte @@ -0,0 +1,22 @@ +<script> + let { createConversation = async (name) => {} } = $props(); + + let name = $state(''); + let disabled = $state(false); + + async function onsubmit(event) { + event.preventDefault(); + disabled = true; + try { + await createConversation(name); + event.target.reset(); + } finally { + disabled = false; + } + } +</script> + +<form {onsubmit}> + <input type="text" placeholder="start a conversation" bind:value={name} {disabled} /> + <button type="submit">➕</button> +</form> |
