@@ -0,0 +1,23 @@
|
||||
import { Moon, Sun } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { useAppearance } from '@/hooks/use-appearance';
|
||||
|
||||
/** Light/dark switch for the admin panel header. */
|
||||
export function AdminThemeToggle() {
|
||||
const { resolvedAppearance, updateAppearance } = useAppearance();
|
||||
const isDark = resolvedAppearance === 'dark';
|
||||
const label = isDark ? 'Ganti ke mode terang' : 'Ganti ke mode gelap';
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
aria-label={label}
|
||||
title={label}
|
||||
onClick={() => updateAppearance(isDark ? 'light' : 'dark')}
|
||||
className="size-9 cursor-pointer"
|
||||
>
|
||||
{isDark ? <Sun className="size-4" /> : <Moon className="size-4" />}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user