move router decorator into stories

This makes it possible to define other routes that "/" inside each story.
This commit is contained in:
Sebastian Sdorra
2020-03-30 15:01:51 +02:00
parent 2ab2079e07
commit 23f4c3cba9
5 changed files with 8 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ import DownloadButton from "./DownloadButton";
import EditButton from "./EditButton";
import SubmitButton from "./SubmitButton";
import { ReactElement } from "react";
import { MemoryRouter } from "react-router-dom";
const colors = ["primary", "link", "info", "success", "warning", "danger", "white", "light", "dark", "black", "text"];
@@ -42,6 +43,7 @@ const Spacing = styled.div`
const SpacingDecorator = (story: () => ReactNode) => <Spacing>{story()}</Spacing>;
storiesOf("Buttons|Button", module)
.addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
.add("Colors", () => (
<div>
{colors.map(color => (