()
| 3 | import Icon from "./Icon"; |
| 4 | |
| 5 | const DarkModeSwitch = () => { |
| 6 | const settingStore = useSettingStore(); |
| 7 | const isDarkMode = useDarkMode(); |
| 8 | |
| 9 | const switchDarkMode = () => { |
| 10 | if (isDarkMode) { |
| 11 | settingStore.setTheme("light"); |
| 12 | } else { |
| 13 | settingStore.setTheme("dark"); |
| 14 | } |
| 15 | }; |
| 16 | |
| 17 | const ModeIcon = isDarkMode ? Icon.IoMdMoon : Icon.IoMdSunny; |
| 18 | |
| 19 | return ( |
| 20 | <button |
| 21 | className="w-10 h-10 p-1 rounded-full flex flex-row justify-center items-center hover:bg-gray-100 dark:hover:bg-zinc-700" |
| 22 | onClick={switchDarkMode} |
| 23 | > |
| 24 | <ModeIcon className="text-gray-600 dark:text-gray-300 w-6 h-auto" /> |
| 25 | </button> |
| 26 | ); |
| 27 | }; |
| 28 | |
| 29 | export default DarkModeSwitch; |
nothing calls this directly
no test coverage detected