snp-batch-validation/frontend/src/contexts/ThemeContext.tsx

27 lines
638 B
TypeScript
Raw Normal View 히스토리

import { createContext, useContext, type ReactNode } from 'react';
import { useTheme } from '../hooks/useTheme';
interface ThemeContextValue {
theme: 'dark' | 'light';
toggle: () => void;
}
const ThemeContext = createContext<ThemeContextValue>({
theme: 'dark',
toggle: () => {},
});
export function ThemeProvider({ children }: { children: ReactNode }) {
const value = useTheme();
return (
<ThemeContext.Provider value={value}>
{children}
</ThemeContext.Provider>
);
}
// eslint-disable-next-line react-refresh/only-export-components
export function useThemeContext() {
return useContext(ThemeContext);
}