design-system-simplefi
Version:
Design System for SimpleFi Applications
39 lines • 1.77 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import PropTypes from 'prop-types';
import { ThemeProvider } from 'styled-components';
import { mergeDeepRight } from 'ramda';
import { theme as defaultTheme } from '../theme';
import { GlobalStyles } from '../GlobalStyles';
export var defaultDSContext = {
portalsContainerId: 'portals',
hasIncludedGlobalStyles: true,
};
export var DSContext = React.createContext(defaultDSContext);
var DSProvider = function (_a) {
var children = _a.children, _b = _a.theme, theme = _b === void 0 ? {} : _b, _c = _a.config, config = _c === void 0 ? {} : _c;
var dsTheme = mergeDeepRight(defaultTheme, theme);
var _d = mergeDeepRight(defaultDSContext, config), hasIncludedGlobalStyles = _d.hasIncludedGlobalStyles, dsConfig = __rest(_d, ["hasIncludedGlobalStyles"]);
return (React.createElement(ThemeProvider, { theme: dsTheme },
hasIncludedGlobalStyles && React.createElement(GlobalStyles, null),
React.createElement(DSContext.Provider, { value: dsConfig }, children)));
};
DSProvider.propTypes = {
theme: PropTypes.shape({}),
config: PropTypes.shape({
portalsContainer: PropTypes.string,
hasIncludedGlobalStyles: PropTypes.bool,
}),
};
export default DSProvider;
//# sourceMappingURL=DSProvider.js.map