Skip to content

Commit

Permalink
Add visually hidden text to theme switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Curetix committed Jun 8, 2024
1 parent 0214403 commit a2bd5af
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/components/settings-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Stack,
Switch,
Text,
VisuallyHidden,
rem,
useMantineColorScheme,
} from "@mantine/core";
Expand Down Expand Up @@ -89,6 +90,10 @@ function SettingsModal({ opened, onClose }: SettingsModalProps) {
setLocale(locale);
};

const themeIconProps = {
style: { width: rem(16), height: rem(16), display: "block" },
};

const settingsItems: SettingsItem[] = [
{
title: LL.THEME(),
Expand All @@ -99,25 +104,28 @@ function SettingsModal({ opened, onClose }: SettingsModalProps) {
{
value: "light",
label: (
<Center>
<IconBrightnessUp style={{ width: rem(16), height: rem(16) }} />
</Center>
<>
<IconBrightnessUp {...themeIconProps} />
<VisuallyHidden>{LL.THEME_LIGHT()}</VisuallyHidden>
</>
),
},
{
value: "dark",
label: (
<Center>
<IconMoonStars style={{ width: rem(16), height: rem(16) }} />
</Center>
<>
<IconMoonStars {...themeIconProps} />
<VisuallyHidden>{LL.THEME_DARK()}</VisuallyHidden>
</>
),
},
{
value: "auto",
label: (
<Center>
<IconBrightness style={{ width: rem(16), height: rem(16) }} />
</Center>
<>
<IconBrightness {...themeIconProps} />
<VisuallyHidden>{LL.THEME_AUTO()}</VisuallyHidden>
</>
),
},
]}
Expand Down

0 comments on commit a2bd5af

Please sign in to comment.