Files
route-commerce/src/components/admin/SideNavGroup.tsx
T
Nora f6bf91951e fix: react-doctor small categories 68→72 (a11y+perf+style, 21 fixes)
- no-outline-none (2): add focus-visible outline to inline-styled inputs
- no-redundant-roles (2): drop role="list" on <ul>
- click-events-have-key-events (2): convert div backdrops to buttons
- no-static-element-interactions (2): add role+tabIndex+onKeyDown to clickable divs
- rendering-svg-precision (2): round SVG path decimals
- no-tiny-text (2): 11px → 12px on CommandPalette hints
- js-set-map-lookups (4→1): Sets for visibleItems, regex for keyword match
- no-gray-on-colored-background (4): use color-matched text instead of stone-400/900
- no-transition-all (4): list specific properties in transition shorthand
2026-06-26 03:54:30 -06:00

50 lines
1.4 KiB
TypeScript

import React from "react";
/**
* SideNavGroup — a presentational wrapper that renders an optional group
* label (10px uppercase, tracking-widest) and a hairline divider, then
* passes the nav item children through unchanged.
*
* Used by AdminSidebar to chunk the long list of admin links into the
* 7 IA groups defined in `docs/superpowers/specs/2026-06-17-admin-redesign.md`
* (Workspace · Operations · Communications · Growth · Tracking · Insights · Settings).
*
* `collapsed` is a future-proofing prop for a per-group collapse toggle;
* it visually hides the children but keeps the label + divider in place.
*/
type SideNavGroupProps = {
label?: string;
children: React.ReactNode;
collapsed?: boolean;
};
export default function SideNavGroup({
label,
children,
collapsed = false,
}: SideNavGroupProps) {
return (
<section
className="px-3 pb-3"
aria-label={label ? `${label} section` : undefined}
>
{label && (
<div
className="flex items-center gap-2 px-3 pt-3 pb-2 mb-1 border-b"
style={{ borderColor: "rgba(208, 203, 180, 0.12)" }}
>
<span
className="text-[10px] font-semibold uppercase tracking-widest select-none"
style={{ color: "rgba(184, 180, 168, 0.5)" }}
>
{label}
</span>
</div>
)}
<ul className="space-y-1" hidden={collapsed}>
{children}
</ul>
</section>
);
}