mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-28 18:43:53 +08:00
feat: implement dark mode (#27)
* feat: implement dark mode * feat: update data table dark mode style * chore: update
This commit is contained in:
36
src/components/ThemeSelector.tsx
Normal file
36
src/components/ThemeSelector.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
import { useSettingStore } from "@/store";
|
||||
import { Theme } from "@/types";
|
||||
import Select from "./kit/Select";
|
||||
|
||||
interface ThemeItem {
|
||||
value: Theme;
|
||||
label: string;
|
||||
}
|
||||
|
||||
const themeItemList: ThemeItem[] = [
|
||||
{
|
||||
value: "system",
|
||||
label: "System",
|
||||
},
|
||||
{
|
||||
value: "light",
|
||||
label: "Light",
|
||||
},
|
||||
{
|
||||
value: "dark",
|
||||
label: "Dark",
|
||||
},
|
||||
];
|
||||
|
||||
const ThemeSelector = () => {
|
||||
const settingStore = useSettingStore();
|
||||
const theme = settingStore.setting.theme;
|
||||
|
||||
const handleThemeChange = (theme: Theme) => {
|
||||
settingStore.setTheme(theme);
|
||||
};
|
||||
|
||||
return <Select className="w-28" value={theme} itemList={themeItemList} onValueChange={handleThemeChange} />;
|
||||
};
|
||||
|
||||
export default ThemeSelector;
|
Reference in New Issue
Block a user