From b4bd717f09bd05767f220998113e1a212e7ec240 Mon Sep 17 00:00:00 2001 From: MinamiFunakoshiTR Date: Thu, 6 Mar 2025 15:59:19 -0800 Subject: [PATCH] finished infobox, adds docs --- src/components/InfoBox/InfoBox.mdx | 54 ++++++++++++++-- src/components/InfoBox/InfoBox.stories.svelte | 63 ++++++++++++++++++- src/components/InfoBox/InfoBox.svelte | 2 +- 3 files changed, 110 insertions(+), 9 deletions(-) diff --git a/src/components/InfoBox/InfoBox.mdx b/src/components/InfoBox/InfoBox.mdx index 85db0094..eaeef2de 100644 --- a/src/components/InfoBox/InfoBox.mdx +++ b/src/components/InfoBox/InfoBox.mdx @@ -1,4 +1,4 @@ -import { Meta, Canvas } from '@storybook/blocks'; +import { Meta } from '@storybook/blocks'; import * as InfoBoxStories from './InfoBox.stories.svelte'; @@ -20,10 +20,12 @@ InfoBox is used to provide additional information that needs to be visually set /> ``` -You can use InfoBoox as a list by creating a list with a **ArchieML doc** in the **Graphics Kit** like this: +## Lists + +You can use InfoBoox as a list by creating a list with a **ArchieML doc** in the **Graphics Kit** like in this [example](/story/components-text-elements-infobox--lists): ```yaml -# TEST THIS START HERE +# ArchieML [infoBox] title: What you need to know about the war text: @@ -50,12 +52,52 @@ text: {/each} ``` -## List - ## Theme Switch the theme prop to `dark` for a dark page infobox. ## Customisation -Use [snippets](https://svelte.dev/docs/svelte/snippet) to customise the content as needed, e.g. adding icons and thumbnail images. +Use [snippets](https://svelte.dev/docs/svelte/snippet), which are the Svelte 5 version of slots, to customise the content as needed, e.g. adding tables, icons and thumbnail images, like in this [example](/story/components-text-elements-infobox--customised). + +```svelte + + + {#snippet header()} +

COVID-19 deaths

+ {/snippet} + + {#snippet body()} + + + + + + + + + + + + + + + + + + + + + + + + + +
CountryInfectionsDeaths
United States1,000,000100,000
United Kingdom500,00050,000
Italy250,00025,000
+ {/snippet} + + {#snippet updated()} + Note: This is dummy data + {/snippet} +
+``` diff --git a/src/components/InfoBox/InfoBox.stories.svelte b/src/components/InfoBox/InfoBox.stories.svelte index dcc39d58..34033a82 100644 --- a/src/components/InfoBox/InfoBox.stories.svelte +++ b/src/components/InfoBox/InfoBox.stories.svelte @@ -34,10 +34,69 @@ /> +/> + + + {#snippet header()} +

COVID-19 deaths

+ {/snippet} + {#snippet body()} + + + + + + + + + + + + + + + + + + + + + + + + + +
CountryInfectionsDeaths
United States1,000,000100,000
United Kingdom500,00050,000
Italy250,00025,000
+ {/snippet} + {#snippet footer()} + Note: This is dummy data + {/snippet} +
+
+ + diff --git a/src/components/InfoBox/InfoBox.svelte b/src/components/InfoBox/InfoBox.svelte index f52a6fe8..52d915a8 100644 --- a/src/components/InfoBox/InfoBox.svelte +++ b/src/components/InfoBox/InfoBox.svelte @@ -13,7 +13,7 @@ /** * Contents of the note as a markdown string */ - text: string; + text?: string; /** * Additional footnotes */