siakad-itm/resources/js/components/appearance-tabs.tsx
Yoga Pangestu 70d37741ef
Some checks failed
tests / ci (pull_request) Has been cancelled
Refactor admin settings structure and implement profile and security management
- Moved profile and security settings from the general settings route to a dedicated admin settings route.
- Created new components and pages for managing user profile and security settings.
- Updated user menu to link to the new admin settings pages.
- Removed old settings pages and routes that are no longer in use.
- Added tests for profile and security settings functionality.
2026-08-25 17:57:47 +07:00

46 lines
1.7 KiB
TypeScript

import type { LucideIcon } from 'lucide-react';
import { Monitor, Moon, Sun } from 'lucide-react';
import type { HTMLAttributes } from 'react';
import type { Appearance } from '@/hooks/use-appearance';
import { useAppearance } from '@/hooks/use-appearance';
import { cn } from '@/lib/utils';
export default function AppearanceToggleTab({
className = '',
...props
}: HTMLAttributes<HTMLDivElement>) {
const { appearance, updateAppearance } = useAppearance();
const tabs: { value: Appearance; icon: LucideIcon; label: string }[] = [
{ value: 'light', icon: Sun, label: 'Terang' },
{ value: 'dark', icon: Moon, label: 'Gelap' },
{ value: 'system', icon: Monitor, label: 'Sistem' },
];
return (
<div
className={cn(
'inline-flex gap-1 rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800',
className,
)}
{...props}
>
{tabs.map(({ value, icon: Icon, label }) => (
<button
key={value}
onClick={() => updateAppearance(value)}
className={cn(
'flex items-center rounded-md px-3.5 py-1.5 transition-colors',
appearance === value
? 'bg-white shadow-xs dark:bg-neutral-700 dark:text-neutral-100'
: 'text-neutral-500 hover:bg-neutral-200/60 hover:text-black dark:text-neutral-400 dark:hover:bg-neutral-700/60',
)}
>
<Icon className="-ml-1 h-4 w-4" />
<span className="ml-1.5 text-sm">{label}</span>
</button>
))}
</div>
);
}