Skip to content

Commit f6e4970

Browse files
Tighten settings nav and add Escape back navigation
- Reduce settings sidebar typography for a denser layout - Close settings with Escape by navigating back
1 parent 73b2f25 commit f6e4970

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

apps/web/src/components/settings/SettingsSidebarNav.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
4141
isActive={isActive}
4242
className={
4343
isActive
44-
? "gap-2 px-2 py-2 text-left text-sm text-foreground"
45-
: "gap-2 px-2 py-2 text-left text-sm text-muted-foreground hover:text-foreground/80"
44+
? "gap-2 px-2 py-2 text-left text-xs text-foreground"
45+
: "gap-2 px-2 py-2 text-left text-xs text-muted-foreground hover:text-foreground/80"
4646
}
4747
onClick={() => void navigate({ to: item.to, replace: true })}
4848
>
@@ -68,7 +68,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
6868
<SidebarMenuItem>
6969
<SidebarMenuButton
7070
size="sm"
71-
className="gap-2 px-2 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
71+
className="gap-2 px-2 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground"
7272
onClick={() => window.history.back()}
7373
>
7474
<ArrowLeftIcon className="size-4" />

apps/web/src/routes/settings.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RotateCcwIcon } from "lucide-react";
22
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
3-
import { useState } from "react";
3+
import { useEffect, useState } from "react";
44

55
import { useSettingsRestore } from "../components/settings/SettingsPanels";
66
import { Button } from "../components/ui/button";
@@ -13,6 +13,21 @@ function SettingsContentLayout() {
1313
setRestoreSignal((value) => value + 1),
1414
);
1515

16+
useEffect(() => {
17+
const onKeyDown = (event: KeyboardEvent) => {
18+
if (event.defaultPrevented) return;
19+
if (event.key === "Escape") {
20+
event.preventDefault();
21+
window.history.back();
22+
}
23+
};
24+
25+
window.addEventListener("keydown", onKeyDown);
26+
return () => {
27+
window.removeEventListener("keydown", onKeyDown);
28+
};
29+
}, []);
30+
1631
return (
1732
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground isolate">
1833
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground">

0 commit comments

Comments
 (0)