~ 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
80 lines · 2.0 KB Raw History
<script lang="ts">
  import Button from '../atoms/Button.svelte'
  import Icon from '../atoms/Icon.svelte'
  import Identity from '../molecules/Identity.svelte'

  let {
    authority,
    isAuthority,
    onleave,
  }: {
    authority: string
    isAuthority: boolean
    /** Delete the club (authority), or forget it (member) */
    onleave: () => void
  } = $props()
</script>

<section class="card" aria-labelledby="about-title">
  <h2 id="about-title">About this club</h2>
  <dl>
    <div>
      <dt><Icon name="users" size={14} /> Hosted by</dt>
      <dd><Identity did={authority} size="sm" /></dd>
    </div>
    <div>
      <dt><Icon name="lock" size={14} /> Access</dt>
      <dd>Only members can see the club and its reviews.</dd>
    </div>
    <div>
      <dt><Icon name="pen" size={14} /> Your reviews</dt>
      <dd>Saved to your own account, so they stay yours if you leave.</dd>
    </div>
  </dl>
  <div class="leave">
    {#if isAuthority}
      <Button variant="ghost-danger" icon="trash" onclick={onleave}>Delete club</Button>
    {:else}
      <Button variant="ghost-danger" icon="x" onclick={onleave}>Remove from my list</Button>
    {/if}
  </div>
</section>

<style>
  .card {
    display: grid;
    gap: var(--space-4);
    padding: var(--space-5);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }
  h2 {
    font-size: var(--text-lg);
  }
  dl {
    display: grid;
    gap: var(--space-3);
    margin: 0;
  }
  dt {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
    color: var(--color-text-subtle);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  dd {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
  }
  .leave {
    margin-left: calc(-1 * var(--space-3));
  }
</style>