Skip to content
Permalink
Newer
Older
100644 29 lines (25 sloc) 853 Bytes
Ignoring revisions in .git-blame-ignore-revs.
1
import PropTypes from 'prop-types';
2
3
export default function StyledEngineProvider(props) {
4
const { injectFirst, children } = props;
5
6
if (injectFirst && typeof window !== 'undefined') {
7
const head = document.head;
8
if (!head.querySelector('[data-styled="active"]')) {
9
const injectFirstNode = document.createElement('style');
10
injectFirstNode.setAttribute('data-styled', 'active');
11
head.insertBefore(injectFirstNode, head.firstChild);
12
}
18
StyledEngineProvider.propTypes = {
19
/**
20
* Your component tree.
21
*/
22
children: PropTypes.node,
23
/**
24
* By default, the styles are injected last in the <head> element of the page.
25
* As a result, they gain more specificity than any other style sheet.
26
* If you want to override MUI's styles, set this prop.
27
*/
28
injectFirst: PropTypes.bool,
29
};