fix(customer): customer sidebar active state matches admin pattern

This commit is contained in:
Luca
2026-05-11 16:48:29 +02:00
parent eb0c45e0f4
commit 8d9d0bea83
+22 -14
View File
@@ -175,24 +175,32 @@ export const CustomerLayout: React.FC = () => {
key={item.to} key={item.to}
to={item.to} to={item.to}
onClick={() => setSidebarOpen(false)} onClick={() => setSidebarOpen(false)}
className="flex items-center gap-3 px-3 py-2 text-sm font-medium rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2" className={`flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors ${
style={isActive ? { isActive
backgroundColor: 'color-mix(in srgb, var(--color-accent) 12%, transparent)', ? 'bg-accent-dark text-white'
color: 'var(--color-accent)', : 'text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:text-neutral-900 dark:hover:text-neutral-100'
} : undefined} }`}
> >
<Icon className={`w-5 h-5 flex-shrink-0 ${isActive ? '' : 'text-muted-theme'}`} /> {/* Mirrors AdminSidebar's active state exactly: solid
<span className={`flex-1 truncate ${isActive ? '' : 'text-theme'}`}> accent-dark pill, white icon and label, no extra
flex grow on the label so the pill width matches
what the admin chrome renders. */}
<Icon
className={`w-5 h-5 mr-3 ${
isActive ? 'text-white' : 'text-neutral-400'
}`}
/>
{t(item.labelKey, item.fallback)} {t(item.labelKey, item.fallback)}
</span> {/* Coming-soon pill for the gated entries. Pushed to
{/* Coming-soon pill for the gated entries. The pages the right of the label with ml-auto so it doesn't
themselves are still placeholders even when the add the flex-1 stretching that was throwing off
admin has enabled access — the badge keeps that the active-pill visual. */}
promise honest. */}
{item.feature && ( {item.feature && (
<span <span
className="text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded font-semibold" className={`ml-auto text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded font-semibold ${
style={{ isActive ? 'bg-white/20 text-white' : ''
}`}
style={isActive ? undefined : {
backgroundColor: 'color-mix(in srgb, var(--color-accent) 14%, transparent)', backgroundColor: 'color-mix(in srgb, var(--color-accent) 14%, transparent)',
color: 'var(--color-accent)', color: 'var(--color-accent)',
}} }}