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

@@ -26,8 +26,7 @@
"flow-bin": "^0.109.0",
"flow-typed": "^2.5.1",
"raf": "^3.4.0",
"storybook-addon-i18next": "^1.2.1",
"storybook-react-router": "^1.0.8"
"storybook-addon-i18next": "^1.2.1"
},
"dependencies": {
"@scm-manager/ui-extensions": "2.0.0-SNAPSHOT",

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 => (

View File

@@ -11484,13 +11484,6 @@ storybook-addon-i18next@^1.2.1:
prop-types "^15.7.2"
react-i18next "^10.11.4"
storybook-react-router@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/storybook-react-router/-/storybook-react-router-1.0.8.tgz#8d174eba1c38fff2c7e459c3d0c2463bc0cd9c6a"
integrity sha512-3PvuTu6cJHtF72WC3aKdIrUY1eUYsdVYEmW74nZiJoLCn0C/6iDx73w94jgI6lXq75aEJsri+lEDyhcokfP6YA==
dependencies:
prop-types "^15.7.2"
stream-browserify@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"