CoastalCommitsPastes/client/app/components/theme/ThemeProvider.tsx
Max Leiter 12d9eafcd9 lint
2022-11-17 22:36:53 -08:00

28 lines
718 B
TypeScript

import type { FunctionComponent, PropsWithChildren } from "react"
import ThemeClientContextProvider from "./ThemeClientContextProvider"
import ThemeServerContextProvider, {
useServerTheme
} from "./ThemeServerContextProvider"
const ThemeProviderWrapper: FunctionComponent<PropsWithChildren<{}>> = ({
children
}) => {
const theme = useServerTheme()
return (
<ThemeClientContextProvider defaultTheme={theme}>
{children}
</ThemeClientContextProvider>
)
}
const ThemeProvider: FunctionComponent<PropsWithChildren<{}>> = ({
children
}) => {
return (
<ThemeServerContextProvider>
<ThemeProviderWrapper>{children}</ThemeProviderWrapper>
</ThemeServerContextProvider>
)
}
export default ThemeProvider