thunderhub/.storybook/themeDecorator.js
Anthony Potdevin aa60d618f9
Feat/nextjs (#25)
* feat: initial nextjs commit

* chore: general card styles changes

* chore: add storybook

* chore: small changes and fixes

* fix: trading filter encoding

* fix: add link to node

* chore: set to correct version
2020-04-12 18:27:01 +02:00

35 lines
982 B
JavaScript

import React from 'react';
import styled, { ThemeProvider, css } from 'styled-components';
import { select, boolean } from '@storybook/addon-knobs';
import { backgroundColor, cardColor } from '../src/styles/Themes';
const StyledBackground = styled.div`
width: 100%;
height: 100%;
padding: 100px 0;
${({ withBackground, cardBackground }) =>
withBackground &&
css`
background: ${cardBackground ? cardColor : backgroundColor};
`}
display: flex;
justify-content: center;
align-items: center;
`;
const ThemeDecorator = storyFn => {
const background = boolean('No Background', false);
const cardBackground = boolean('Card Background', true);
return (
<ThemeProvider theme={{ mode: select('Theme', ['dark', 'light'], 'dark') }}>
<StyledBackground
withBackground={!background}
cardBackground={cardBackground}
>
{storyFn()}
</StyledBackground>
</ThemeProvider>
);
};
export default ThemeDecorator;