Skip to content

Instantly share code, notes, and snippets.

@oakfang
Created January 1, 2020 07:04
Show Gist options
  • Save oakfang/ea417dae1803f4ca4a1089b194a888ff to your computer and use it in GitHub Desktop.
Save oakfang/ea417dae1803f4ca4a1089b194a888ff to your computer and use it in GitHub Desktop.
center decorator
import React from "react";
import { configure, addDecorator } from "@storybook/react";
import styled from "styled-components";
import { MemoryRouter } from "react-router-dom";
import { ThemeService } from "services/theme";
const Center = styled.div`
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
`;
addDecorator(story => (
<MemoryRouter>
<ThemeService>
<Center>{story()}</Center>
</ThemeService>
</MemoryRouter>
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment