MCPcopy Create free account
hub / github.com/Codehagen/Badget / ModeSwitcher

Function ModeSwitcher

src/components/mode-switcher.tsx:7–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { Button } from "@/components/ui/button";
6
7export function ModeSwitcher() {
8 const { setTheme, resolvedTheme } = useTheme();
9
10 const toggleTheme = React.useCallback(() => {
11 setTheme(resolvedTheme === "dark" ? "light" : "dark");
12 }, [resolvedTheme, setTheme]);
13
14 return (
15 <Button
16 variant="ghost"
17 size="icon"
18 className="group/toggle extend-touch-target size-8"
19 onClick={toggleTheme}
20 title="Toggle theme"
21 >
22 <svg
23 xmlns="http://www.w3.org/2000/svg"
24 width="24"
25 height="24"
26 viewBox="0 0 24 24"
27 fill="none"
28 stroke="currentColor"
29 strokeWidth="2"
30 strokeLinecap="round"
31 strokeLinejoin="round"
32 className="size-4.5"
33 >
34 <path stroke="none" d="M0 0h24v24H0z" fill="none" />
35 <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" />
36 <path d="M12 3l0 18" />
37 <path d="M12 9l4.65 -4.65" />
38 <path d="M12 14.3l7.37 -7.37" />
39 <path d="M12 19.6l8.85 -8.85" />
40 </svg>
41 <span className="sr-only">Toggle theme</span>
42 </Button>
43 );
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected