Group the admin nav into Data, Pages, Forms, Tools and Panel
The header now has one menu per group: its name opens the first item, and hovering or tabbing into it drops down the rest. The strip under the header lists the open group's items, which is also the way around on a touch screen. The admin home shows the same groups as card blocks, from the same list in adminNav.ts. Data holds the record types, Pages the front page, timeline, blog posts and the Community blog section, Tools the media library and QR codes. Docs and comments name the new menu paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
06e443ba23
commit
29202f2eb1
7 changed files with 173 additions and 121 deletions
|
|
@ -9,10 +9,14 @@
|
|||
wordmark names whichever one you're in, and from anywhere but
|
||||
Home it's the way back to Home.
|
||||
|
||||
The tab row is drawn everywhere except Home, where the card grid
|
||||
is the navigation and drawing both would say the same thing
|
||||
twice. Which tabs appear depends on the signed-in user
|
||||
(navFor() drops the superadmin-only ones), but that's cosmetics.
|
||||
The group menus (Data, Pages, Forms, Tools, Panel: adminNav.ts)
|
||||
are drawn everywhere except Home, where the card grid is the
|
||||
navigation and drawing both would say the same thing twice. Each
|
||||
group's name opens its first item and hovering it lists the rest;
|
||||
the strip under the header lists the open group's items, which is
|
||||
also the way around on a touch screen. Which groups appear depends
|
||||
on the signed-in user (navFor() drops the superadmin-only ones),
|
||||
but that's cosmetics.
|
||||
The route guard and the API are what actually say no.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
|
|
@ -33,6 +37,52 @@ import {
|
|||
target,
|
||||
} from "./adminNav.ts";
|
||||
|
||||
/* One group in the header. The name opens the group's first item;
|
||||
hovering it, or tabbing into it, drops down the rest. The menu is
|
||||
CSS only (group-hover, group-focus-within), so it can't get stuck
|
||||
open, and a keyboard reaches every item by tabbing on from the
|
||||
name. A group of one has nothing to drop down. */
|
||||
function GroupMenu({ item, lit, pathname }) {
|
||||
const children = item.children ?? [];
|
||||
const link = lit
|
||||
? "font-semibold text-[#138ba0]"
|
||||
: "text-[#4a6b72] transition-colors hover:text-[#138ba0]";
|
||||
|
||||
return (
|
||||
<div className="group relative">
|
||||
<NavLink to={target(item)} className={`flex items-center gap-1 ${link}`}>
|
||||
{item.label}
|
||||
{children.length > 1 && (
|
||||
<span aria-hidden="true" className="text-[10px] opacity-60">
|
||||
▾
|
||||
</span>
|
||||
)}
|
||||
</NavLink>
|
||||
|
||||
{children.length > 1 && (
|
||||
<div className="invisible absolute left-0 top-full z-30 pt-2 opacity-0 transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
|
||||
<ul className="min-w-52 rounded-xl border border-[#138ba0]/20 bg-white p-1.5 shadow-lg">
|
||||
{children.map((child) => (
|
||||
<li key={child.to}>
|
||||
<NavLink
|
||||
to={child.to}
|
||||
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-[#eef9fb] ${
|
||||
matches(pathname, child.to)
|
||||
? "font-semibold text-[#138ba0]"
|
||||
: "text-[#26454c]"
|
||||
}`}
|
||||
>
|
||||
{child.label}
|
||||
</NavLink>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function AdminLayout() {
|
||||
const { user, logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -109,16 +159,7 @@ export default function AdminLayout() {
|
|||
className="h-4 w-px bg-[#4a6b72]/25"
|
||||
/>
|
||||
)}
|
||||
<NavLink
|
||||
to={target(item)}
|
||||
className={
|
||||
item === active
|
||||
? "font-semibold text-[#138ba0]"
|
||||
: "text-[#4a6b72] transition-colors hover:text-[#138ba0]"
|
||||
}
|
||||
>
|
||||
{item.label}
|
||||
</NavLink>
|
||||
<GroupMenu item={item} lit={item === active} pathname={pathname} />
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue