[GH-307] Increase clickable area on sidebar items (#344)

This moves the click handler from sidebar item titles to the sidebar items
themselves. This way, the clickable area matches with the visually highlighted
area on hover.

Fixes: #307
This commit is contained in:
Johannes Marbach 2021-04-28 16:05:43 +02:00 committed by GitHub
parent a918af6200
commit 1b5f580e44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -30,6 +30,10 @@
} }
} }
&:not(.no-views) {
cursor: pointer;
}
>.Icon { >.Icon {
stroke: rgba(var(--sidebar-fg), 0.3); stroke: rgba(var(--sidebar-fg), 0.3);
height: 14px; height: 14px;
@ -72,7 +76,6 @@
.octo-sidebar-title { .octo-sidebar-title {
font-weight: 600; font-weight: 600;
cursor: pointer;
flex-grow: 1; flex-grow: 1;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View file

@ -83,16 +83,16 @@ const SidebarBoardItem = React.memo((props: Props) => {
return ( return (
<div className='SidebarBoardItem'> <div className='SidebarBoardItem'>
<div className={'octo-sidebar-item ' + (collapsed ? 'collapsed' : 'expanded')}> <div
className={'octo-sidebar-item ' + (collapsed ? 'collapsed' : 'expanded')}
onClick={() => props.showBoard(board.id)}
>
<IconButton <IconButton
icon={<DisclosureTriangle/>} icon={<DisclosureTriangle/>}
onClick={() => setCollapsed(!collapsed)} onClick={() => setCollapsed(!collapsed)}
/> />
<div <div
className='octo-sidebar-title' className='octo-sidebar-title'
onClick={() => {
props.showBoard(board.id)
}}
title={displayTitle} title={displayTitle}
> >
{board.icon ? `${board.icon} ${displayTitle}` : displayTitle} {board.icon ? `${board.icon} ${displayTitle}` : displayTitle}
@ -151,13 +151,11 @@ const SidebarBoardItem = React.memo((props: Props) => {
<div <div
key={view.id} key={view.id}
className='octo-sidebar-item subitem' className='octo-sidebar-item subitem'
onClick={() => props.showView(view.id, board.id)}
> >
{iconForViewType(view.viewType)} {iconForViewType(view.viewType)}
<div <div
className='octo-sidebar-title' className='octo-sidebar-title'
onClick={() => {
props.showView(view.id, board.id)
}}
title={view.title || intl.formatMessage({id: 'Sidebar.untitled-view', defaultMessage: '(Untitled View)'})} title={view.title || intl.formatMessage({id: 'Sidebar.untitled-view', defaultMessage: '(Untitled View)'})}
> >
{view.title || intl.formatMessage({id: 'Sidebar.untitled-view', defaultMessage: '(Untitled View)'})} {view.title || intl.formatMessage({id: 'Sidebar.untitled-view', defaultMessage: '(Untitled View)'})}