summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-07-07 16:11:59 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-07-08 19:47:56 -0400
commit3fd175165ee262f0180b78d2dd206a993c20200c (patch)
treec3128312661362f9c5b8b386b9061ccea3a5b5f6
parentc631c8fc855b1854f14fc7fbf1d8afedaa37a0db (diff)
Create a swatch for the `ConversationList` component.
-rw-r--r--ui/routes/(swatch)/.swatch/+page.svelte1
-rw-r--r--ui/routes/(swatch)/.swatch/ConversationList/+page.svelte54
2 files changed, 55 insertions, 0 deletions
diff --git a/ui/routes/(swatch)/.swatch/+page.svelte b/ui/routes/(swatch)/.swatch/+page.svelte
index abcb53f..c8f2133 100644
--- a/ui/routes/(swatch)/.swatch/+page.svelte
+++ b/ui/routes/(swatch)/.swatch/+page.svelte
@@ -8,5 +8,6 @@
<h2>components</h2>
<ul>
+ <li><a href="ConversationList">ConversationList</a></li>
<li><a href="swatch/EventLog">swatch/EventLog</a></li>
</ul>
diff --git a/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte
new file mode 100644
index 0000000..1a56966
--- /dev/null
+++ b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte
@@ -0,0 +1,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 class="html" 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>