From 0783a080e8b7975573ed89781bbe90839a0a289d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Sun, 3 Mar 2024 15:08:02 +0100 Subject: [PATCH] feat: allow for linking between stories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to link between stories in Storybook I need to add some attribute to elements, so that the events are prevented and navigation can be handled by Storybook. Signed-off-by: André Jaenisch --- .prettierignore | 1 + src/lib/components/organisms/LoginForm.svelte | 7 ++++++- src/lib/components/templates/Login.svelte | 12 +++++++++++- src/lib/components/templates/Profile.svelte | 7 ++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.prettierignore b/.prettierignore index 3897265..4c899c6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,6 +6,7 @@ node_modules .env .env.* !.env.example +/storybook-static # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml diff --git a/src/lib/components/organisms/LoginForm.svelte b/src/lib/components/organisms/LoginForm.svelte index cfb5257..a6e8a58 100644 --- a/src/lib/components/organisms/LoginForm.svelte +++ b/src/lib/components/organisms/LoginForm.svelte @@ -15,6 +15,11 @@ * Available servers for signin */ export let servers: Array = []; + + /** + * Allow for linking stories in Storybook. + */ + export let sb = '';
@@ -50,7 +55,7 @@ {$_(i18n.reset)} -
diff --git a/src/lib/components/templates/Login.svelte b/src/lib/components/templates/Login.svelte index d19f1a4..533c97c 100644 --- a/src/lib/components/templates/Login.svelte +++ b/src/lib/components/templates/Login.svelte @@ -7,6 +7,10 @@ * Form handling by SvelteKit */ export let form: unknown = null; + + /** + * Translation keys to enable reuse + */ const i18n = { fields: { account: { @@ -27,6 +31,12 @@ missing: 'page.login.form.validation.missing' } }; + + /** + * Allow for linking stories in Storybook. + */ + export let sb = ''; + const servers = { '1': 'fig.fr33domlover.site', '2': 'grape.fr33domlover.site', @@ -38,6 +48,6 @@

{$_('page.login.heading')}

{$_('page.login.intro')}

- +
diff --git a/src/lib/components/templates/Profile.svelte b/src/lib/components/templates/Profile.svelte index 912416d..883bea6 100644 --- a/src/lib/components/templates/Profile.svelte +++ b/src/lib/components/templates/Profile.svelte @@ -13,6 +13,11 @@ * Required context for populating the template. */ export let data: ProfileData = null; + + /** + * Allow for linking stories in Storybook. + */ + export let sb = '';
@@ -60,7 +65,7 @@ values: { addElementOpen: '', addElementClose: '', - importElementOpen: '', + importElementOpen: ``, importElementClose: '' } })}