summaryrefslogtreecommitdiff
path: root/ui/lib/components/MessageInput.svelte
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-11-02 20:02:24 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-11-02 20:02:24 -0400
commit22ce0549e20ee397cf5953bd6b7aafc752deaa28 (patch)
tree59e116cd0a198de04a2dbd3bbb632ec3dee6fed5 /ui/lib/components/MessageInput.svelte
parent0e14a3b7e365c05992848cfbc4b8d7d9681d6d04 (diff)
Run prettier, make lint part of pre-commit
Diffstat (limited to 'ui/lib/components/MessageInput.svelte')
-rw-r--r--ui/lib/components/MessageInput.svelte50
1 files changed, 30 insertions, 20 deletions
diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte
index 03ac7fa..7aac442 100644
--- a/ui/lib/components/MessageInput.svelte
+++ b/ui/lib/components/MessageInput.svelte
@@ -1,28 +1,38 @@
<script>
- import { tick } from 'svelte';
- import { postToChannel } from '$lib/apiServer';
+ import { tick } from 'svelte';
+ import { postToChannel } from '$lib/apiServer';
- export let channel = null;
- let input;
- let value = '';
- let pending = false;
+ export let channel = null;
+ let input;
+ let value = '';
+ let pending = false;
- $: disabled = pending || (channel === null);
+ $: disabled = pending || channel === null;
- async function handleSubmit() {
- if (channel !== null) {
- pending = true;
- // TODO try/catch:
- await postToChannel(channel, value);
- pending = false;
- value = '';
- await tick();
- input.focus();
- }
- }
+ async function handleSubmit() {
+ if (channel !== null) {
+ pending = true;
+ // TODO try/catch:
+ await postToChannel(channel, value);
+ pending = false;
+ value = '';
+ await tick();
+ input.focus();
+ }
+ }
</script>
<form on:submit|preventDefault={handleSubmit} class="flex flex-row flex-nowrap">
- <input bind:this={input} bind:value={value} disabled={disabled} type="search" class="flex-auto h-6 input rounded-r-none" />
- <button color="primary variant-filled-secondary" type="submit" class="flex-none w-6 h-6 btn-icon variant-filled rounded-l-none">&raquo;</button>
+ <input
+ bind:this={input}
+ bind:value
+ {disabled}
+ type="search"
+ class="flex-auto h-6 input rounded-r-none"
+ />
+ <button
+ color="primary variant-filled-secondary"
+ type="submit"
+ class="flex-none w-6 h-6 btn-icon variant-filled rounded-l-none">&raquo;</button
+ >
</form>