Library: keep New folder / New page header actions always visible
release gate / check (push) Failing after 5m30s
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:
@@ -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
|
||||
expanded: boolean
|
||||
onToggle: () => void
|
||||
action?: { 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 }> }) => {
|
||||
if (!a) return null
|
||||
@@ -170,7 +171,10 @@ function GroupHeader({ label, expanded, onToggle, action, action2 }: {
|
||||
onClick={a.onClick}
|
||||
title={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" />
|
||||
</button>
|
||||
@@ -722,6 +726,7 @@ function SidebarNav({ open, pathname, isAdmin = false }: { open: boolean; pathna
|
||||
onToggle={() => setPagesExpanded(!pagesExpanded)}
|
||||
action={{ label: 'New folder', onClick: () => void createFolder(), icon: FolderPlus }}
|
||||
action2={{ label: 'New page', onClick: () => void createPage() }}
|
||||
alwaysVisibleActions
|
||||
/>
|
||||
{pagesExpanded && (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user