mirror of
https://github.com/vercel/components.build.git
synced 2026-09-14 20:06:39 +08:00
101ca62c2d
* Initial implementation * Bump deps * Update code-block.tsx * Update navbar.tsx * Move video to Geistdocs * Update layout.tsx * Margin fixes * Update code-block-tabs.tsx * Update docs-page.tsx * Update navbar.tsx * Add feed * Update docs-layout.tsx * Update mobile-menu.tsx * Fix adaptable layout * Update docs-page.tsx * Update docs page composability * Update global.css * Remove unused AI Elements * Update Feedback
21 lines
535 B
TypeScript
21 lines
535 B
TypeScript
"use client";
|
|
|
|
import { MoonIcon, SunIcon } from "lucide-react";
|
|
import { useTheme } from "next-themes";
|
|
import { Button } from "../ui/button";
|
|
|
|
export const ThemeToggle = () => {
|
|
const { resolvedTheme, setTheme } = useTheme();
|
|
const Icon = resolvedTheme === "dark" ? MoonIcon : SunIcon;
|
|
|
|
const handleClick = () => {
|
|
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
};
|
|
|
|
return (
|
|
<Button onClick={handleClick} size="icon-sm" type="button" variant="ghost">
|
|
<Icon className="size-4" />
|
|
</Button>
|
|
);
|
|
};
|