()
| 7 | import { Button } from "@/components/ui/button" |
| 8 | |
| 9 | export function ThemeToggle() { |
| 10 | const { setTheme, theme } = useTheme() |
| 11 | const [mounted, setMounted] = React.useState(false) |
| 12 | |
| 13 | React.useEffect(() => { |
| 14 | setMounted(true) |
| 15 | }, []) |
| 16 | |
| 17 | if (!mounted) { |
| 18 | return null |
| 19 | } |
| 20 | |
| 21 | return ( |
| 22 | <Button |
| 23 | variant="ghost" |
| 24 | size="sm" |
| 25 | onClick={() => setTheme(theme === "light" ? "dark" : "light")} |
| 26 | > |
| 27 | {theme === "dark" ? ( |
| 28 | <Sun className="h-5 w-5 rotate-0 scale-100 transition-all" /> |
| 29 | ) : ( |
| 30 | <Moon className="h-5 w-5 rotate-0 scale-100 transition-all" /> |
| 31 | )} |
| 32 | <span className="sr-only">Toggle theme</span> |
| 33 | </Button> |
| 34 | ) |
| 35 | } |
nothing calls this directly
no outgoing calls
no test coverage detected