()
| 3 | import { useTheme } from "./theme-provider"; |
| 4 | |
| 5 | export function ThemeToggle() { |
| 6 | const { theme, setTheme } = useTheme(); |
| 7 | |
| 8 | const toggleTheme = () => { |
| 9 | const newTheme = theme === "dark" ? "light" : "dark"; |
| 10 | console.log(`Switching theme from ${theme} to ${newTheme}`); |
| 11 | setTheme(newTheme); |
| 12 | }; |
| 13 | |
| 14 | // Log the current theme to help with debugging |
| 15 | console.log("Current theme:", theme); |
| 16 | |
| 17 | return ( |
| 18 | <Button |
| 19 | variant="ghost" |
| 20 | size="icon" |
| 21 | onClick={toggleTheme} |
| 22 | title={`Switch to ${theme === "dark" ? "light" : "dark"} theme`} |
| 23 | > |
| 24 | {theme === "dark" ? ( |
| 25 | <Sun className="h-5 w-5" /> |
| 26 | ) : ( |
| 27 | <Moon className="h-5 w-5" /> |
| 28 | )} |
| 29 | <span className="sr-only">Toggle theme</span> |
| 30 | </Button> |
| 31 | ); |
| 32 | } |
nothing calls this directly
no test coverage detected