summaryrefslogtreecommitdiff
path: root/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte
blob: ef0c8a951d62da8ebe77e7cdd7251c6325b2d58d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script>
  import { json } from '$lib/swatch/derive.js';

  import ConversationList from '$lib/components/ConversationList.svelte';

  let conversationsInput = $state(
    JSON.stringify(
      [
        {
          id: 'Czero',
          name: 'A long conversation',
          hasUnreads: false,
        },
        {
          id: 'Cone',
          name: 'A shorter conversation',
          hasUnreads: true,
        },
      ],
      /* replacer */ null,
      /* space */ 2,
    ),
  );
  let conversations = $derived(json(conversationsInput));

  let active = $state(null);
</script>

<h1><code>ConversationList</code></h1>

<nav><p><a href=".">Back to swatches</a></p></nav>

<h2>properties</h2>

<div class="component-properties">
  <label
    ><p>conversations (json)</p>
    <textarea bind:value={conversationsInput}></textarea>
  </label>

  <label>active <input type="text" bind:value={active} /></label>
  <div class="suggestion">
    interesting values:
    <button onclick={() => (active = null)}>(none)</button>
    <button onclick={() => (active = 'Czero')}>Czero</button>
    <button onclick={() => (active = 'Cone')}>Cone</button>
  </div>
</div>

<h2>rendered</h2>

<div class="component-preview">
  <ConversationList {conversations} {active} />
</div>