Some checks failed
CI / Verify (push) Has been cancelled
API: lists, items and invitations modules (list, create, get, update, set-primary, items create/list, invitation create/accept/list-pending), BetterAuth session helper, list membership, mailer and Prisma schema plus migrations. Web: lists overview, list detail (items) and list management (settings) views, item and invitation forms/hooks, sign-up and invitation accept pages. Shared: shopping list DTOs. Tooling: ignore the generated TanStack Router cache (apps/web/.tanstack).
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { MonitorIcon, MoonIcon, SunIcon } from 'lucide-react'
|
|
|
|
import { useTheme } from '@/components/theme-provider'
|
|
import { Button } from '@/components/ui/button'
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from '@/components/ui/dropdown-menu'
|
|
|
|
const OPTIONS = [
|
|
{ value: 'light', label: 'Claro', icon: SunIcon },
|
|
{ value: 'dark', label: 'Oscuro', icon: MoonIcon },
|
|
{ value: 'system', label: 'Sistema', icon: MonitorIcon },
|
|
] as const
|
|
|
|
export function ThemeToggle() {
|
|
const { setTheme } = useTheme()
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button variant="ghost" size="icon" aria-label="Cambiar tema">
|
|
<SunIcon className="size-4 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" />
|
|
<MoonIcon className="absolute size-4 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end">
|
|
{OPTIONS.map(({ value, label, icon: Icon }) => (
|
|
<DropdownMenuItem key={value} onClick={() => setTheme(value)}>
|
|
<Icon />
|
|
{label}
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|