Library: keep New folder / New page header actions always visible
release gate / check (push) Failing after 5m30s

The Library group's add-folder and add-page icons were hover-only; make them
persistently visible (other group headers keep hover-reveal).
This commit is contained in:
Andrew S Erwin
2026-12-01 06:39:29 -06:00
parent 830f40d55e
commit 521987e16d
+7 -2
View File
@@ -155,12 +155,13 @@ export function Sidebar({ open, mobileOpen = false, onToggle, onCloseMobile, onQ
) )
} }
function GroupHeader({ label, expanded, onToggle, action, action2 }: { function GroupHeader({ label, expanded, onToggle, action, action2, alwaysVisibleActions = false }: {
label: string label: string
expanded: boolean expanded: boolean
onToggle: () => void onToggle: () => void
action?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> } action?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> }
action2?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> } action2?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> }
alwaysVisibleActions?: boolean
}) { }) {
const renderAction = (a?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> }) => { const renderAction = (a?: { label: string; onClick: () => void; icon?: React.ComponentType<{ className?: string }> }) => {
if (!a) return null if (!a) return null
@@ -170,7 +171,10 @@ function GroupHeader({ label, expanded, onToggle, action, action2 }: {
onClick={a.onClick} onClick={a.onClick}
title={a.label} title={a.label}
aria-label={a.label} aria-label={a.label}
className="shrink-0 rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover/header:opacity-100 focus-visible:opacity-100" className={cn(
'shrink-0 rounded p-1 text-muted-foreground transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100',
alwaysVisibleActions ? 'opacity-100' : 'opacity-0 group-hover/header:opacity-100'
)}
> >
<Icon className="h-3.5 w-3.5" /> <Icon className="h-3.5 w-3.5" />
</button> </button>
@@ -722,6 +726,7 @@ function SidebarNav({ open, pathname, isAdmin = false }: { open: boolean; pathna
onToggle={() => setPagesExpanded(!pagesExpanded)} onToggle={() => setPagesExpanded(!pagesExpanded)}
action={{ label: 'New folder', onClick: () => void createFolder(), icon: FolderPlus }} action={{ label: 'New folder', onClick: () => void createFolder(), icon: FolderPlus }}
action2={{ label: 'New page', onClick: () => void createPage() }} action2={{ label: 'New page', onClick: () => void createPage() }}
alwaysVisibleActions
/> />
{pagesExpanded && ( {pagesExpanded && (
<> <>