From 41793146be482a2c283ededd17f9ab8b494b43a7 Mon Sep 17 00:00:00 2001 From: Timo Zehnle Date: Thu, 9 Sep 2021 16:24:07 +0200 Subject: [PATCH] fix Provider problem --- .../src/Provider/MarigoldProvider.tsx | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/packages/components/src/Provider/MarigoldProvider.tsx b/packages/components/src/Provider/MarigoldProvider.tsx index 4517602f33..d3b311fa07 100644 --- a/packages/components/src/Provider/MarigoldProvider.tsx +++ b/packages/components/src/Provider/MarigoldProvider.tsx @@ -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'; @@ -41,8 +18,8 @@ export const MarigoldProvider: React.FC = ({ theme, children, }) => { - const outerTheme = useMarigoldTheme(); - const isTopLevel = outerTheme === defaultThemeValue; + const outerTheme = useTheme(); + const isTopLevel = outerTheme.theme !== theme; return (