Update various components
This commit is contained in:
@@ -10,7 +10,7 @@ const themeInitialState: ThemeProviderState = {
|
||||
const ThemeProviderContext = createContext<ThemeProviderState>(themeInitialState);
|
||||
|
||||
|
||||
export default function ThemeProvider(props: ThemeProviderProps){
|
||||
export default function ThemeProvider(props: Readonly<ThemeProviderProps>){
|
||||
const {
|
||||
children,
|
||||
defaultTheme = "system",
|
||||
@@ -20,12 +20,12 @@ export default function ThemeProvider(props: ThemeProviderProps){
|
||||
const [ theme, setTheme ] = useState<Theme>((localStorage.getItem(storageKey) as Theme) || defaultTheme);
|
||||
|
||||
useEffect(() => {
|
||||
const root = window.document.documentElement;
|
||||
const root = globalThis.document.documentElement;
|
||||
|
||||
root.classList.remove("light", "dark");
|
||||
|
||||
if(theme === "system"){
|
||||
const systemTheme = window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
|
||||
const systemTheme = globalThis.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
|
||||
|
||||
root.classList.add(systemTheme);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const ToasterProviderContext = createContext<ToastProviderState>(toastInitialSta
|
||||
export default function ToasterProvider({
|
||||
className,
|
||||
children
|
||||
}: ToastProviderProps){
|
||||
}: Readonly<ToastProviderProps>){
|
||||
const [ toast, setToast ] = useState<Toast[]>([]);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user