Skip to content

Commit

Permalink
added classname directly to ThemeProvider.
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantrawal committed Dec 7, 2023
1 parent cbe2941 commit 2465084
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions demo/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import { ThemeContext } from './common/ThemeContext';

export const CustomThemeProvider = ({
children,
className,
}: {
children: React.ReactNode;
className?: string;
}) => {
const [theme, setTheme] = React.useState<ThemeType>(() =>
window.matchMedia('(prefers-color-scheme: dark)').matches
Expand All @@ -27,7 +25,7 @@ export const CustomThemeProvider = ({

return (
<ThemeContext.Provider value={{ theme, setTheme }}>
<ThemeProvider theme={theme} className={className}>
<ThemeProvider theme={theme} className='custom-theme'>
{children}
</ThemeProvider>
</ThemeContext.Provider>
Expand All @@ -37,7 +35,7 @@ export const CustomThemeProvider = ({
createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<HashRouter>
<CustomThemeProvider className='custom-theme'>
<CustomThemeProvider>
<Routes>
<Route path='/' element={<App />} />
{DEMOS_LIST.map(({ layouts }) =>
Expand Down

0 comments on commit 2465084

Please sign in to comment.