27 lines
532 B
TypeScript
27 lines
532 B
TypeScript
"use client";
|
|
|
|
import { MoonIcon, SunIcon } from "@radix-ui/react-icons";
|
|
|
|
interface ThemeSwapProps {
|
|
isDark: boolean;
|
|
toggleTheme: () => void;
|
|
}
|
|
|
|
export const ThemeSwap: React.FC<ThemeSwapProps> = ({
|
|
isDark,
|
|
toggleTheme,
|
|
}) => {
|
|
return (
|
|
<label className="swap swap-rotate">
|
|
<input
|
|
type="checkbox"
|
|
className="theme-controller"
|
|
checked={isDark}
|
|
onChange={toggleTheme}
|
|
/>
|
|
<MoonIcon className="swap-off h-5 w-5 fill-current" />
|
|
<SunIcon className="swap-on h-5 w-5 fill-current" />
|
|
</label>
|
|
);
|
|
};
|