mirror of
https://github.com/dergigi/boris.git
synced 2026-01-31 12:44:37 +01:00
fix: close mobile sidebar when clicking navigation items
- Add mobile sidebar close logic to handleMenuItemClick for profile menu items - Add mobile sidebar close logic to Home, Settings, and Explore buttons - Fixes issue where mobile bookmarks bar didn't close when navigating to My Reads, My Highlights, etc.
This commit is contained in:
@@ -55,6 +55,10 @@ const SidebarHeader: React.FC<SidebarHeaderProps> = ({ onToggleCollapse, onLogou
|
||||
|
||||
const handleMenuItemClick = (action: () => void) => {
|
||||
setShowProfileMenu(false)
|
||||
// Close mobile sidebar when navigating on mobile
|
||||
if (isMobile) {
|
||||
onToggleCollapse()
|
||||
}
|
||||
action()
|
||||
}
|
||||
|
||||
@@ -127,21 +131,36 @@ const SidebarHeader: React.FC<SidebarHeaderProps> = ({ onToggleCollapse, onLogou
|
||||
<div className="sidebar-header-right">
|
||||
<IconButton
|
||||
icon={faHome}
|
||||
onClick={() => navigate('/')}
|
||||
onClick={() => {
|
||||
if (isMobile) {
|
||||
onToggleCollapse()
|
||||
}
|
||||
navigate('/')
|
||||
}}
|
||||
title="Home"
|
||||
ariaLabel="Home"
|
||||
variant="ghost"
|
||||
/>
|
||||
<IconButton
|
||||
icon={faGear}
|
||||
onClick={onOpenSettings}
|
||||
onClick={() => {
|
||||
if (isMobile) {
|
||||
onToggleCollapse()
|
||||
}
|
||||
onOpenSettings()
|
||||
}}
|
||||
title="Settings"
|
||||
ariaLabel="Settings"
|
||||
variant="ghost"
|
||||
/>
|
||||
<IconButton
|
||||
icon={faPersonHiking}
|
||||
onClick={() => navigate('/explore')}
|
||||
onClick={() => {
|
||||
if (isMobile) {
|
||||
onToggleCollapse()
|
||||
}
|
||||
navigate('/explore')
|
||||
}}
|
||||
title="Explore"
|
||||
ariaLabel="Explore"
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user