~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/spaces-bookclub

Book club: a Svelte demo app for atproto spaces (@atproto/lex-space)

0
0
main
31 lines · 862 B Raw History
<script lang="ts">
  import Input from '../atoms/Input.svelte'
  import Field from '../molecules/Field.svelte'
  import ActionDialog from './ActionDialog.svelte'

  let {
    open = $bindable(false),
    onadd,
  }: { open?: boolean; onadd: (handle: string) => Promise<void> } = $props()

  let handle = $state('')

  $effect(() => {
    if (open) handle = ''
  })
</script>

<ActionDialog
  bind:open
  title="Add a member"
  description="Members can read every review in the club and post their own. Send them the invite link afterwards."
  submitLabel="Add member"
  submitIcon="user-plus"
  onsubmit={() => onadd(handle.trim().replace(/^@/, ''))}
>
  <Field label="Handle">
    {#snippet children(id)}
      <Input {id} bind:value={handle} placeholder="bob.test2" required spellcheck={false} autocapitalize="off" />
    {/snippet}
  </Field>
</ActionDialog>