Files
LandingPage_RivusLab/src/components/ThemeToggle.tsx
T

33 lines
804 B
TypeScript
Raw Normal View History

2026-05-22 18:44:46 -03:00
import { Moon, Sun } from 'lucide-react';
import { useTranslation } from 'react-i18next';
export function ThemeToggle({
isDark,
onToggle,
className = '',
}: {
isDark: boolean;
onToggle: () => void;
className?: string;
}) {
const { t } = useTranslation();
return (
<button
type="button"
onClick={onToggle}
className={[
'inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-md border border-border bg-bg text-fg transition-colors hover:bg-bg-muted',
className,
].join(' ')}
aria-label={isDark ? t('theme.switchToLight') : t('theme.switchToDark')}
>
{isDark ? (
<Sun className="h-5 w-5" aria-hidden="true" />
) : (
<Moon className="h-5 w-5" aria-hidden="true" />
)}
</button>
);
}