1.2 KB35 lines
Blame
1"use client";
2
3import { useTheme } from "@/lib/theme";
4
5export function ThemeToggle() {
6 const { theme, toggle } = useTheme();
7
8 return (
9 <button
10 onClick={toggle}
11 className="btn-reset p-1.5 hover-row"
12 style={{ color: "var(--text-muted)" }}
13 aria-label={`Switch to ${theme === "light" ? "dark" : "light"} mode`}
14 >
15 {theme === "light" ? (
16 <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
17 <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
18 </svg>
19 ) : (
20 <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
21 <circle cx="12" cy="12" r="5" />
22 <line x1="12" y1="1" x2="12" y2="3" />
23 <line x1="12" y1="21" x2="12" y2="23" />
24 <line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
25 <line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
26 <line x1="1" y1="12" x2="3" y2="12" />
27 <line x1="21" y1="12" x2="23" y2="12" />
28 <line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
29 <line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
30 </svg>
31 )}
32 </button>
33 );
34}
35