26 lines
750 B
TypeScript
26 lines
750 B
TypeScript
"use client";
|
||
|
||
import React from "react";
|
||
import { Moon, Sun } from "lucide-react";
|
||
import { useTheme } from "@/components/theme-provider";
|
||
|
||
export function ThemeToggle() {
|
||
const { theme, toggleTheme } = useTheme();
|
||
|
||
return (
|
||
<button
|
||
type="button"
|
||
onClick={toggleTheme}
|
||
className="rounded-md p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-white"
|
||
aria-label={theme === "dark" ? "Aydınlık temaya geç" : "Koyu temaya geç"}
|
||
title={theme === "dark" ? "Aydınlık tema" : "Koyu tema"}
|
||
>
|
||
{theme === "dark" ? (
|
||
<Sun className="size-5" />
|
||
) : (
|
||
<Moon className="size-5" />
|
||
)}
|
||
</button>
|
||
);
|
||
}
|