MOVE: Theme to quick settings

This commit is contained in:
EvanLin3141
2025-02-09 17:19:34 +00:00
parent 8942298b38
commit 4cc48fe0b2
9 changed files with 119 additions and 59 deletions

View File

@@ -0,0 +1,27 @@
import React, { createContext, useContext, useState, ReactNode } from "react";
// Theme context and types
interface ThemeContextType {
theme: string;
setTheme: (theme: string) => void;
}
const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
export const ThemeProvider = ({ children }: { children: ReactNode }) => {
const [theme, setTheme] = useState<string>("light");
return (
<ThemeContext.Provider value={{ theme, setTheme }}>
{children}
</ThemeContext.Provider>
);
};
export const useTheme = () => {
const context = useContext(ThemeContext);
if (!context) {
throw new Error("useTheme must be used within a ThemeProvider");
}
return context;
};