sendou.ink/app/components/layout/SelectedThemeIcon.tsx
Kalle 323a1ea5e3 Remove useTranslation wrapper Closes #1595
This broke after upgrading deps and couldn't figure it out with a quick look.

It just makes it a bit more convenient when adding new pages & debugging
but not really that necessary so decided to delete it for now.
2023-12-07 20:33:59 +02:00

29 lines
705 B
TypeScript

import { useTranslation } from "react-i18next";
import { MoonIcon } from "../icons/Moon";
import { SunIcon } from "../icons/Sun";
import { SunAndMoonIcon } from "../icons/SunAndMoon";
import { Theme, useTheme } from "~/features/theme/core/provider";
const ThemeIcons = {
[Theme.LIGHT]: SunIcon,
[Theme.DARK]: MoonIcon,
auto: SunAndMoonIcon,
};
export function SelectedThemeIcon({ size }: { size?: number }) {
const { t } = useTranslation();
const { userTheme } = useTheme();
if (!userTheme) return null;
const SelectedIcon = ThemeIcons[userTheme];
return (
<SelectedIcon
alt={t("header.theme")}
className="layout__header__button__icon"
size={size}
/>
);
}