mirror of
https://github.com/hex248/ob248.com.git
synced 2026-02-08 10:43:38 +00:00
theme setup
This commit is contained in:
19
src/components/theme-toggle.tsx
Normal file
19
src/components/theme-toggle.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useTheme } from "@/components/theme-provider";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
function ThemeToggle() {
|
||||
const { resolvedTheme, setTheme } = useTheme();
|
||||
const isDark = resolvedTheme === "dark";
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setTheme(isDark ? "light" : "dark")}
|
||||
>
|
||||
{isDark ? "light" : "dark"}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export { ThemeToggle };
|
||||
Reference in New Issue
Block a user