vcc-ui
Version:
A React library for building user interfaces at Volvo Cars
28 lines • 683 B
JavaScript
import PropTypes from 'prop-types';
import React from 'react';
import { ThemeProvider as FelaThemeProvider } from 'react-fela';
import { useConfig } from '../config/use-config';
import { isUnsupportedFontLocale } from '../themes/fonts';
export function ThemeProvider(_ref) {
let {
theme,
children
} = _ref;
const {
locale
} = useConfig();
if (isUnsupportedFontLocale(locale)) {
theme = {
...theme,
fonts: []
};
}
return /*#__PURE__*/React.createElement(FelaThemeProvider, {
theme: theme,
overwrite: false
}, children);
}
ThemeProvider.propTypes = {
theme: PropTypes.object.isRequired,
children: PropTypes.node.isRequired
};