chore: auto-commit before merge (loop primary)
This commit is contained in:
@@ -23,6 +23,7 @@ interface SidebarProps {
|
||||
activeSection: string
|
||||
onNavigate: (tileId: string) => void
|
||||
onSearchClick: () => void
|
||||
forceCollapsed?: boolean
|
||||
}
|
||||
|
||||
interface NavSection {
|
||||
@@ -162,7 +163,7 @@ function AlertFlag({ alert }: AlertFlagProps) {
|
||||
)
|
||||
}
|
||||
|
||||
export default function Sidebar({ activeSection, onNavigate, onSearchClick }: SidebarProps) {
|
||||
export default function Sidebar({ activeSection, onNavigate, onSearchClick, forceCollapsed }: SidebarProps) {
|
||||
const [isDesktop, setIsDesktop] = useState(() => window.matchMedia('(min-width: 1024px)').matches)
|
||||
const [isMobileExpanded, setIsMobileExpanded] = useState(false)
|
||||
|
||||
@@ -184,7 +185,7 @@ export default function Sidebar({ activeSection, onNavigate, onSearchClick }: Si
|
||||
return () => mediaQuery.removeEventListener('change', listener)
|
||||
}, [])
|
||||
|
||||
const isExpanded = isDesktop || isMobileExpanded
|
||||
const isExpanded = (isDesktop && !forceCollapsed) || isMobileExpanded
|
||||
|
||||
const handleNavActivate = (tileId: string) => {
|
||||
onNavigate(tileId)
|
||||
@@ -195,7 +196,7 @@ export default function Sidebar({ activeSection, onNavigate, onSearchClick }: Si
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isDesktop && isMobileExpanded && (
|
||||
{(!isDesktop || forceCollapsed) && isMobileExpanded && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Close sidebar navigation"
|
||||
@@ -234,7 +235,7 @@ export default function Sidebar({ activeSection, onNavigate, onSearchClick }: Si
|
||||
}}
|
||||
className={isExpanded ? 'pmr-scrollbar' : undefined}
|
||||
>
|
||||
{!isDesktop && (
|
||||
{(!isDesktop || forceCollapsed) && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={isExpanded ? 'Collapse sidebar navigation' : 'Expand sidebar navigation'}
|
||||
|
||||
Reference in New Issue
Block a user