feat: support dark mode

This commit is contained in:
GyDi
2021-12-09 23:28:57 +08:00
parent 396b11cc3d
commit c501898d5f
9 changed files with 184 additions and 68 deletions

View File

@@ -1,5 +1,24 @@
import { Box } from "@mui/system";
import { useRecoilState } from "recoil";
import { atomPaletteMode } from "../states/setting";
import PaletteSwitch from "../components/palette-switch";
const SettingPage = () => {
return <h1>Setting</h1>;
const [mode, setMode] = useRecoilState(atomPaletteMode);
return (
<Box>
<h1>Setting</h1>
<Box>
<PaletteSwitch
checked={mode !== "light"}
onChange={(_e, c) => setMode(c ? "dark" : "light")}
inputProps={{ "aria-label": "controlled" }}
/>
</Box>
</Box>
);
};
export default SettingPage;