Add improved settings button

This commit is contained in:
Meierschlumpf
2022-12-04 18:20:25 +01:00
parent d5a3b3f3ba
commit 0970a2b9bc
8 changed files with 78 additions and 92 deletions

View File

@@ -0,0 +1,22 @@
import { Menu, useMantineColorScheme, useMantineTheme } from '@mantine/core';
import { IconMoonStars, IconSun } from '@tabler/icons';
import { useTranslation } from 'next-i18next';
export const ColorSchemeSwitch = () => {
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
const { t } = useTranslation('settings/general/theme-selector');
const Icon = colorScheme === 'dark' ? IconSun : IconMoonStars;
return (
<Menu.Item
closeMenuOnClick={false}
icon={<Icon strokeWidth={1.2} size={18} />}
onClick={() => toggleColorScheme()}
>
{t('label', {
theme: colorScheme === 'dark' ? 'light' : 'dark',
})}
</Menu.Item>
);
};