mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-02 11:36:01 +01:00
Initial commit
This commit is contained in:
26
components/ColorSchemeToggle/ColorSchemeToggle.tsx
Normal file
26
components/ColorSchemeToggle/ColorSchemeToggle.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { ActionIcon, Group, useMantineColorScheme } from '@mantine/core';
|
||||
import { SunIcon, MoonIcon } from '@modulz/radix-icons';
|
||||
|
||||
export function ColorSchemeToggle() {
|
||||
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
||||
|
||||
return (
|
||||
<Group position="center" mt="xl">
|
||||
<ActionIcon
|
||||
onClick={() => toggleColorScheme()}
|
||||
size="xl"
|
||||
sx={(theme) => ({
|
||||
backgroundColor:
|
||||
theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],
|
||||
color: theme.colorScheme === 'dark' ? theme.colors.yellow[4] : theme.colors.blue[6],
|
||||
})}
|
||||
>
|
||||
{colorScheme === 'dark' ? (
|
||||
<SunIcon width={20} height={20} />
|
||||
) : (
|
||||
<MoonIcon width={20} height={20} />
|
||||
)}
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user