Skip to content

Commit

Permalink
fix(theme): move injectGlobal to the function
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed May 23, 2018
1 parent e028e86 commit c797626
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import { atoms } from './atoms';
import * as molecules from './molecules';
import { defaultTheme } from './theme';
import { defaultTheme, resetGlobal } from './theme';

const components = {
...atoms,
...molecules,
};

export { defaultTheme, components };
export { defaultTheme, resetGlobal, components };

export { ThemeProvider } from 'emotion-theming';

1 change: 1 addition & 0 deletions src/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

export { COLORS } from './colors';
export { defaultTheme } from './defaultTheme';
export { resetGlobal } from './reset';
4 changes: 3 additions & 1 deletion src/theme/reset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { injectGlobal } from 'emotion';

injectGlobal`
const resetGlobal = () => injectGlobal`
html {
-webkit-font-smoothing: antialiased;
font-size: 62.5% !important;
Expand Down Expand Up @@ -59,3 +59,5 @@ injectGlobal`
border-spacing: 0;
}
`;

export { resetGlobal };
4 changes: 3 additions & 1 deletion storybook/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React from 'react';
import styled from 'react-emotion';
import { BrowserRouter } from 'react-router-dom';
import { storiesOf } from '@storybook/react';
import { components, ThemeProvider, defaultTheme } from '../src';
import { components, ThemeProvider, defaultTheme, resetGlobal } from '../src';
import { withInfo } from '@storybook/addon-info';

resetGlobal();

const Root = styled('div')`
margin: 2rem;
`;
Expand Down

0 comments on commit c797626

Please sign in to comment.