Skip to content

Commit

Permalink
createGlobalStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
d0ruk committed Feb 4, 2019
1 parent 5dbd548 commit a21ad2a
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions playground.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/* eslint-disable react/prop-types */

import React, { Fragment } from "react";
import Playground from "component-playground";
import ReactDOM from "react-dom";
import styled, { injectGlobal } from "styled-components";
import styled, { createGlobalStyle } from "styled-components";
import { normalize, lighten, complement } from "polished";

import * as components from "./src";

injectGlobal`
const GlobalStyle = createGlobalStyle`
${normalize()}
:root {
Expand All @@ -34,20 +33,24 @@ injectGlobal`
}
`;

const scope = { React, ...components }
const examples = Object.entries(components)
.map(([ name, module ]) => {
return {
name,
// docClass: module,
src: require(`raw-loader!./examples/${name}`),
scope,
}
});
const scope = { React, ...components };
const examples = Object.entries(components).map(([name, module]) => {
return {
name,
// docClass: module,
src: require(`raw-loader!./examples/${name}`),
scope,
};
});

class Index extends React.Component {
render() {
return <Fragment>{examples.map(makePlayground)}</Fragment>;
return (
<Fragment>
<GlobalStyle />
{examples.map(makePlayground)}
</Fragment>
);
}
}

Expand Down

0 comments on commit a21ad2a

Please sign in to comment.