Skip to content

Commit

Permalink
Fix context in storybooks
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Nov 27, 2024
1 parent 765f04b commit cf7153b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script context="module" lang="ts">
import { setContext } from "svelte";
import { writable } from "svelte/store";
import { Story } from "@storybook/addon-svelte-csf";
import type { Document } from "$lib/api/types";
Expand All @@ -18,6 +16,11 @@
tags: ["autodocs"],
parameters: { layout: "fullscreen" },
};
</script>

<script lang="ts">
import { setContext } from "svelte";
import { writable } from "svelte/store";
setContext(
"highlightState",
Expand Down
14 changes: 12 additions & 2 deletions src/lib/components/documents/stories/PageHighlights.stories.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script context="module" lang="ts">
import { setContext } from "svelte";
import { writable } from "svelte/store";
import { Story } from "@storybook/addon-svelte-csf";
import type { Document } from "$lib/api/types";
Expand Down Expand Up @@ -28,6 +26,18 @@
);
</script>

<script lang="ts">
import { setContext } from "svelte";
import { writable } from "svelte/store";
setContext(
"highlightState",
writable({
allOpen: true,
}),
);
</script>

<Story name="closed">
<PageHighlights {document} />
</Story>
Expand Down

0 comments on commit cf7153b

Please sign in to comment.