Skip to content

Commit

Permalink
refactor: use svelte storybook format
Browse files Browse the repository at this point in the history
replace plain typescript storybook format with svelte using
addon-svelte-csf

this requires running test-storybook with --json-index flag. see:
 - storybookjs/addon-svelte-csf#65
 - storybookjs/test-runner#80
  • Loading branch information
DanConwayDev committed Sep 30, 2023
1 parent d663869 commit 73d0554
Show file tree
Hide file tree
Showing 5 changed files with 465 additions and 497 deletions.
3 changes: 2 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { StorybookConfig } from "@storybook/sveltekit";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx|svelte)"],
addons: [
"@storybook/addon-svelte-csf",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test-storybook": "test-storybook",
"test-storybook": "test-storybook --index-json",
"test-storybook:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"yarn build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && yarn test-storybook --maxWorkers=2\""
},
"devDependencies": {
"@storybook/addon-a11y": "^7.4.5",
"@storybook/addon-essentials": "^7.4.5",
"@storybook/addon-interactions": "^7.4.5",
"@storybook/addon-links": "^7.4.5",
"@storybook/addon-svelte-csf": "^4.0.9",
"@storybook/blocks": "^7.4.5",
"@storybook/svelte": "^7.4.5",
"@storybook/sveltekit": "^7.4.5",
Expand Down
34 changes: 0 additions & 34 deletions src/lib/components/Navbar.stories.ts

This file was deleted.

21 changes: 21 additions & 0 deletions src/lib/components/navbar.stories.svelte
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 73d0554

Please sign in to comment.