Spaces:
Running
Running
File size: 812 Bytes
6f5f15e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import { Moon, Sun } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import type { Theme } from '@/lib/theme';
export function ThemeToggle({ theme, onToggle }: { theme: Theme; onToggle: () => void }) {
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon-sm"
onClick={onToggle}
aria-label={theme === 'dark' ? 'Switch to light theme' : 'Switch to dark theme'}
>
{theme === 'dark' ? <Sun className="h-3.5 w-3.5" /> : <Moon className="h-3.5 w-3.5" />}
</Button>
</TooltipTrigger>
<TooltipContent>{theme === 'dark' ? 'Light theme' : 'Dark theme'}</TooltipContent>
</Tooltip>
);
}
|