11 lines
290 B
TypeScript
11 lines
290 B
TypeScript
|
import { useTheme } from "../commons/theme";
|
||
|
|
||
|
export const SwitchTheme = () => {
|
||
|
const { setMode, mode } = useTheme();
|
||
|
|
||
|
if (mode === "light") {
|
||
|
return <button onClick={() => setMode("dark")}>暗色</button>;
|
||
|
}
|
||
|
return <button onClick={() => setMode("light")}>亮色</button>;
|
||
|
};
|