feat(07-02): update Layout toggle to cycle three themes with next-theme label
Some checks failed
Docker / build-and-push (push) Has been cancelled
Some checks failed
Docker / build-and-push (push) Has been cancelled
- Add THEME_CYCLE map for mocha->tokyo-night->latte->mocha - Compute nextThemeLabel for descriptive aria-label/title on toggle button - Update both desktop and mobile toggle button aria-label/title to 'Switch to [theme]' - Icon logic unchanged: Sun in dark mode, Moon in light mode
This commit is contained in:
parent
9710478d6d
commit
bb393b421d
1 changed files with 10 additions and 4 deletions
|
|
@ -59,6 +59,12 @@ export function Layout() {
|
|||
setSelectedCompanyId,
|
||||
} = useCompany();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
const THEME_CYCLE: Record<string, string> = {
|
||||
"catppuccin-mocha": "Tokyo Night",
|
||||
"tokyo-night": "Catppuccin Latte",
|
||||
"catppuccin-latte": "Catppuccin Mocha",
|
||||
};
|
||||
const nextThemeLabel = THEME_CYCLE[theme] ?? "next theme";
|
||||
const { companyPrefix } = useParams<{ companyPrefix: string }>();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
|
@ -331,8 +337,8 @@ export function Layout() {
|
|||
size="icon-sm"
|
||||
className="text-muted-foreground shrink-0"
|
||||
onClick={toggleTheme}
|
||||
aria-label="Cycle theme"
|
||||
title="Cycle theme"
|
||||
aria-label={`Switch to ${nextThemeLabel}`}
|
||||
title={`Switch to ${nextThemeLabel}`}
|
||||
>
|
||||
{isDarkTheme ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />}
|
||||
</Button>
|
||||
|
|
@ -389,8 +395,8 @@ export function Layout() {
|
|||
size="icon-sm"
|
||||
className="text-muted-foreground shrink-0"
|
||||
onClick={toggleTheme}
|
||||
aria-label="Cycle theme"
|
||||
title="Cycle theme"
|
||||
aria-label={`Switch to ${nextThemeLabel}`}
|
||||
title={`Switch to ${nextThemeLabel}`}
|
||||
>
|
||||
{isDarkTheme ? <Sun className="h-4 w-4" /> : <Moon className="h-4 w-4" />}
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue