DocSpace-client/packages/asc-web-components/theme-provider/theme-provider.js
2021-03-11 15:37:33 +03:00

25 lines
556 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { ThemeProvider as Provider } from "styled-components";
import GlobalStyle from "../utils/globalStyles";
const ThemeProvider = (props) => {
const { theme, children } = props;
return (
<Provider theme={theme}>
<GlobalStyle />
{children}
</Provider>
);
};
ThemeProvider.propTypes = {
/** Child elements */
children: PropTypes.any,
/** Applies a theme to all children components */
theme: PropTypes.object.isRequired,
};
export default ThemeProvider;