Skip to content

Commit

Permalink
fix Provider problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ti10le committed Sep 9, 2021
1 parent 64d88a0 commit 4179314
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions packages/components/src/Provider/MarigoldProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
import React from 'react';
import { OverlayProvider } from '@react-aria/overlays';
import {
Theme,
ThemeProvider,
ThemeProviderProps,
useTheme,
} from '@marigold/system';
// import { Global } from '@emotion/react';
// import { css } from '@theme-ui/css';

interface ThemeContextValue {
theme: Theme;
}

const defaultThemeValue: ThemeContextValue = {
theme: {},
};

/**
* @internal
*/
const __MarigoldContext = React.createContext(defaultThemeValue);

const useMarigoldTheme = () => React.useContext(__MarigoldContext);

import { ThemeProvider, ThemeProviderProps, useTheme } from '@marigold/system';
// import { Global } from '@emotion/react';
// import { css } from '@theme-ui/css';

Expand All @@ -41,8 +18,8 @@ export const MarigoldProvider: React.FC<ThemeProviderProps> = ({
theme,
children,
}) => {
const outerTheme = useMarigoldTheme();
const isTopLevel = outerTheme === defaultThemeValue;
const outerTheme = useTheme();
const isTopLevel = outerTheme.theme !== theme;

return (
<ThemeProvider theme={theme}>
Expand Down

0 comments on commit 4179314

Please sign in to comment.