-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from MuckRock/storybook-updates
Storybook updates and fixes
- Loading branch information
Showing
60 changed files
with
809 additions
and
843 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,32 @@ | ||
<script> | ||
import { rest } from "msw"; | ||
import { Meta, Story, Template } from "@storybook/addon-svelte-csf"; | ||
<script lang="ts" context="module"> | ||
import { Story, Template } from "@storybook/addon-svelte-csf"; | ||
import Browser from "../Browser.svelte"; | ||
import listFixture from "../../fixtures/addon-list.json"; | ||
import { baseApiUrl } from "../../../api/base.js"; | ||
const args = { visible: true }; | ||
const mockUrl = new URL(`addons/`, baseApiUrl).toString(); | ||
/* Mock Request Handlers */ | ||
const data = rest.get(mockUrl, (req, res, ctx) => res(ctx.json(listFixture))); | ||
const loading = rest.get(mockUrl, (req, res, ctx) => | ||
res(ctx.delay("infinite")), | ||
); | ||
const error = rest.get(mockUrl, (req, res, ctx) => | ||
res( | ||
ctx.status(400, "Ambiguous Error"), | ||
ctx.json("Something went horribly wrong."), | ||
), | ||
); | ||
const empty = rest.get(mockUrl, (req, res, ctx) => | ||
res(ctx.json({ next: null, previous: null, results: [] })), | ||
); | ||
</script> | ||
import { addons } from "./mockData"; | ||
<Meta | ||
title="Add-Ons / Browser" | ||
tags={["autodocs"]} | ||
parameters={{ layout: "fullscreen" }} | ||
component={Browser} | ||
/> | ||
export const meta = { | ||
title: "Add-Ons / Browser", | ||
tags: ["autodocs"], | ||
parameters: { layout: "fullscreen" }, | ||
component: Browser, | ||
}; | ||
</script> | ||
|
||
<Template let:args> | ||
<Browser {...args} /> | ||
</Template> | ||
|
||
<Story name="Success" {args} parameters={{ msw: { handlers: [data] } }} /> | ||
<Story name="Loading" {args} parameters={{ msw: { handlers: [loading] } }} /> | ||
<Story name="Error" {args} parameters={{ msw: { handlers: [error] } }} /> | ||
<Story name="Empty" {args} parameters={{ msw: { handlers: [empty] } }} /> | ||
<Story | ||
name="Success" | ||
{args} | ||
parameters={{ msw: { handlers: [addons.data] } }} | ||
/> | ||
<Story | ||
name="Loading" | ||
{args} | ||
parameters={{ msw: { handlers: [addons.loading] } }} | ||
/> | ||
<Story name="Error" {args} parameters={{ msw: { handlers: [addons.error] } }} /> | ||
<Story name="Empty" {args} parameters={{ msw: { handlers: [addons.empty] } }} /> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
<script> | ||
import { Meta, Story, Template } from "@storybook/addon-svelte-csf"; | ||
<script lang="ts" context="module"> | ||
import { Story, Template } from "@storybook/addon-svelte-csf"; | ||
import SearchInput from "../SearchInput.svelte"; | ||
import SearchInputDemo from "./SearchInput.demo.svelte"; | ||
const args = {}; | ||
export const meta = { | ||
title: "Add-Ons / Browser / Components / Search", | ||
tags: ["autodocs"], | ||
parameters: { layout: "centered" }, | ||
component: SearchInput, | ||
}; | ||
</script> | ||
|
||
<Meta | ||
title="Add-Ons / Browser / Components / Search" | ||
tags={["autodocs"]} | ||
parameters={{ layout: "centered" }} | ||
component={SearchInput} | ||
/> | ||
<Template let:args> | ||
<SearchInput {...args} /> | ||
</Template> | ||
|
||
<Story name="Search"> | ||
<SearchInputDemo /> | ||
</Story> | ||
<Story name="Search" {args} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { rest } from "msw"; | ||
import listFixture from "../../fixtures/addon-list.json"; | ||
import { baseApiUrl } from "../../../api/base.js"; | ||
|
||
const mockAddonUrl = new URL(`addons/`, baseApiUrl).toString(); | ||
/* Mock Request Handlers */ | ||
export const addons = { | ||
data: rest.get(mockAddonUrl, (req, res, ctx) => res(ctx.json(listFixture))), | ||
loading: rest.get(mockAddonUrl, (req, res, ctx) => | ||
res(ctx.delay("infinite")), | ||
), | ||
error: rest.get(mockAddonUrl, (req, res, ctx) => | ||
res( | ||
ctx.status(400, "Ambiguous Error"), | ||
ctx.json("Something went horribly wrong."), | ||
), | ||
), | ||
empty: rest.get(mockAddonUrl, (req, res, ctx) => | ||
res(ctx.json({ next: null, previous: null, results: [] })), | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.