DocSpace-client/packages/asc-web-components/theme-provider/theme-provider.js

25 lines
556 B
JavaScript
Raw Normal View History

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