mirror of
https://github.com/vercel/streamdown.git
synced 2026-09-19 02:18:37 +08:00
44ae73eaaf
* Initial migration * Update homepage * Delete .source * Fix gitignores * Draft content * Finish drafting content, migrate FAQ * Update code-blocks.tsx * Update route.ts * Update next config * Upgrade to Next.js 16, fix commands * Update layout.tsx
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>
|
|
);
|
|
};
|