Tighten settings nav and add Escape back navigation (#1503)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-03-28 22:01:37 +00:00
1 parent 73b2f255a9
commit c426452239
2 files changed
+19 -4

No files matched your search

@@ -41,8 +41,8 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
isActive={isActive}
className={
isActive
? "gap-2 px-2 py-2 text-left text-sm text-foreground"
: "gap-2 px-2 py-2 text-left text-sm text-muted-foreground hover:text-foreground/80"
? "gap-2 px-2 py-2 text-left text-xs text-foreground"
: "gap-2 px-2 py-2 text-left text-xs text-muted-foreground hover:text-foreground/80"
}
onClick={() => void navigate({ to: item.to, replace: true })}
>
@@ -68,7 +68,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
<SidebarMenuItem>
<SidebarMenuButton
size="sm"
className="gap-2 px-2 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground"
className="gap-2 px-2 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground"
onClick={() => window.history.back()}
>
<ArrowLeftIcon className="size-4" />
+16 -1
View File
@@ -1,6 +1,6 @@
import { RotateCcwIcon } from "lucide-react";
import { Outlet, createFileRoute, redirect } from "@tanstack/react-router";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useSettingsRestore } from "../components/settings/SettingsPanels";
import { Button } from "../components/ui/button";
@@ -13,6 +13,21 @@ function SettingsContentLayout() {
setRestoreSignal((value) => value + 1),
);
useEffect(() => {
const onKeyDown = (event: KeyboardEvent) => {
if (event.defaultPrevented) return;
if (event.key === "Escape") {
event.preventDefault();
window.history.back();
}
};
window.addEventListener("keydown", onKeyDown);
return () => {
window.removeEventListener("keydown", onKeyDown);
};
}, []);
return (
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground isolate">
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground">