Browse Source
replace plain typescript storybook format with svelte using addon-svelte-csf this requires running test-storybook with --json-index flag. see: - https://github.com/storybookjs/addon-svelte-csf/issues/65 - https://github.com/storybookjs/test-runner/issues/80master
5 changed files with 465 additions and 497 deletions
@ -1,34 +0,0 @@ |
|||||||
import type { Meta, StoryObj } from '@storybook/svelte'; |
|
||||||
|
|
||||||
import Navbar from '$lib/components/navbar.svelte'; |
|
||||||
|
|
||||||
// More on how to set up stories at: https://storybook.js.org/docs/svelte/writing-stories/introduction
|
|
||||||
const meta = { |
|
||||||
title: 'Navbar', |
|
||||||
component: Navbar, |
|
||||||
tags: ['autodocs'], |
|
||||||
argTypes: { |
|
||||||
nip07plugin: { control: 'boolean' }, |
|
||||||
}, |
|
||||||
} satisfies Meta<Navbar>; |
|
||||||
|
|
||||||
export default meta; |
|
||||||
type Story = StoryObj<typeof meta>; |
|
||||||
|
|
||||||
// More on writing stories with args: https://storybook.js.org/docs/svelte/writing-stories/args
|
|
||||||
export const Default: Story = { |
|
||||||
args: { |
|
||||||
}, |
|
||||||
}; |
|
||||||
|
|
||||||
export const NoNIP07: Story = { |
|
||||||
args: { |
|
||||||
nip07plugin: false, |
|
||||||
}, |
|
||||||
}; |
|
||||||
|
|
||||||
export const NIP07Exists: Story = { |
|
||||||
args: { |
|
||||||
nip07plugin: true, |
|
||||||
}, |
|
||||||
}; |
|
||||||
@ -0,0 +1,21 @@ |
|||||||
|
<script lang="ts" context="module"> |
||||||
|
import type { Meta } from "@storybook/svelte"; |
||||||
|
import Navbar from "$lib/components/navbar.svelte"; |
||||||
|
import { Story, Template } from "@storybook/addon-svelte-csf"; |
||||||
|
|
||||||
|
export const meta: Meta<Navbar> = { |
||||||
|
title: "Navbar", |
||||||
|
component: Navbar, |
||||||
|
tags: ["autodocs"], |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<Template let:args> |
||||||
|
<Navbar {...args} /> |
||||||
|
</Template> |
||||||
|
|
||||||
|
<Story name="Default" /> |
||||||
|
|
||||||
|
<Story name="NoNIP07" args={{ nip07plugin: false }} /> |
||||||
|
|
||||||
|
<Story name="NIP07Exists" args={{ nip07plugin: true }} /> |
||||||
Loading…
Reference in new issue