summaryrefslogtreecommitdiff
path: root/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte
blob: b0bc97a520d7ca95239f49694c514e3bb3c84ae1 (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
<script>
  import * as json from '$lib/swatch/json.js';

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

  let conversationsInput = $state(
    json.encode([
      {
        id: 'Czero',
        name: 'A long conversation',
        hasUnreads: false,
      },
      {
        id: 'Cone',
        name: 'A shorter conversation',
        hasUnreads: true,
      },
    ]),
  );
  let conversations = $derived(json.decode(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>