use memoryrouter for decorating stories, which are using withRouter

This commit is contained in:
Sebastian Sdorra
2019-10-12 15:43:30 +02:00
parent 016579774d
commit b94b7403d4
3 changed files with 5 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
import React from "react";
import Button from "./Button";
import { storiesOf } from "@storybook/react";
import StoryRouter from "storybook-react-router";
import styled from "styled-components";
import { MemoryRouter } from 'react-router-dom';
const colors = [
"primary",
@@ -23,7 +23,9 @@ const Spacing = styled.div`
`;
storiesOf("Button", module)
.addDecorator(StoryRouter())
.addDecorator(story => (
<MemoryRouter initialEntries={['/']}>{story()}</MemoryRouter>
))
.add("Colors", () => (
<div>
{colors.map(color => (