Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
64adde7b
Unverified
Commit
64adde7b
authored
Jun 25, 2019
by
Robert Knight
Committed by
GitHub
Jun 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1193 from hypothesis/menu-hover-state-experiments
Separate hover areas for main action and submenu toggle
parents
a284417b
1edd42c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
40 deletions
+51
-40
menu-item.js
src/sidebar/components/menu-item.js
+19
-17
menu-item.scss
src/styles/sidebar/components/menu-item.scss
+32
-23
No files found.
src/sidebar/components/menu-item.js
View file @
64adde7b
...
...
@@ -69,23 +69,25 @@ function MenuItem({
role
=
"menuitem"
{...(
onClick
&&
onActivate
(
'menuitem'
,
onClick
))}
>
{
hasLeftIcon
&&
(
<
div
className
=
"menu-item__icon-container"
>
{
leftIcon
}
<
/div
>
)}
{
href
&&
(
<
a
className
=
{
labelClass
}
href
=
{
href
}
target
=
"_blank"
rel
=
"noopener noreferrer"
>
{
label
}
<
/a
>
)}
{
!
href
&&
<
span
className
=
{
labelClass
}
>
{
label
}
<
/span>
}
{
hasRightIcon
&&
(
<
div
className
=
"menu-item__icon-container"
>
{
rightIcon
}
<
/div
>
)}
<
div
className
=
"menu-item__action"
>
{
hasLeftIcon
&&
(
<
div
className
=
"menu-item__icon-container"
>
{
leftIcon
}
<
/div
>
)}
{
href
&&
(
<
a
className
=
{
labelClass
}
href
=
{
href
}
target
=
"_blank"
rel
=
"noopener noreferrer"
>
{
label
}
<
/a
>
)}
{
!
href
&&
<
span
className
=
{
labelClass
}
>
{
label
}
<
/span>
}
{
hasRightIcon
&&
(
<
div
className
=
"menu-item__icon-container"
>
{
rightIcon
}
<
/div
>
)}
<
/div
>
{
typeof
isSubmenuVisible
===
'boolean'
&&
(
<
div
className
=
"menu-item__toggle"
...
...
src/styles/sidebar/components/menu-item.scss
View file @
64adde7b
...
...
@@ -3,7 +3,6 @@ $menu-item-padding: 10px;
.menu-item
{
@include
outline-on-keyboard-focus
;
$item-padding
:
$menu-item-padding
;
$item-height
:
40px
;
color
:
$grey-6
;
...
...
@@ -14,7 +13,6 @@ $menu-item-padding: 10px;
align-items
:
center
;
min-width
:
150px
;
min-height
:
$item-height
;
padding-left
:
$item-padding
;
// TODO - Make the link fill the full available vertical space.
cursor
:
pointer
;
...
...
@@ -22,45 +20,52 @@ $menu-item-padding: 10px;
// Prevent menu item text from being selected when user toggles menu.
user-select
:
none
;
&
:hover
{
background
:
$grey-1
;
}
// An item in a submenu associated with a top-level item.
&
--submenu
{
min-height
:
$item-height
-
10px
;
background
:
$grey-1
;
color
:
mix
(
$grey-5
,
$grey-6
,
$weight
:
50%
);
font-weight
:
normal
;
&
:hover
{
// Since submenu items already have a light grey background, we need to
// use a slightly darker grey as the hover state.
background
:
$grey-3
;
color
:
$grey-6
;
}
}
&
.is-disabled
{
.menu-item__label
{
color
:
$grey-4
;
}
&
.is-expanded
{
background
:
$grey-1
;
}
}
&
.is-expanded
{
// The container for the clickable area of the menu item which triggers its
// main action. For menu items without submenus, this covers the full area of
// the menu item. For menu items with submenus, this covers the full area
// except for the toggle that opens the submenu.
.menu-item__action
{
align-self
:
stretch
;
display
:
flex
;
flex-grow
:
1
;
align-items
:
center
;
padding-left
:
$menu-item-padding
;
&
:hover
{
background
:
$grey-1
;
// Since expanded items already have a light grey background, we need to
// make the hover state a little darker. This should match submenu items'
// hover state.
&
:hover
{
.menu-item.is-expanded
&
{
// Since expanded items already have a light grey background, we need to
// make the hover state a little darker. This should match submenu items'
// hover state.
background
:
$grey-3
;
}
// Since submenu items already have a light grey background, we need to
// use a slightly darker grey as the hover state.
.menu-item--submenu
&
{
background
:
$grey-3
;
color
:
$grey-6
;
}
}
&
.is-selected
{
.menu-item.is-selected
&
{
$border-width
:
4px
;
border-left
:
$border-width
solid
$brand
;
padding-left
:
$item-padding
-
$border-width
;
padding-left
:
$
menu-
item-padding
-
$border-width
;
}
}
...
...
@@ -98,6 +103,10 @@ $menu-item-padding: 10px;
&
--submenu
{
font-weight
:
normal
;
}
.menu-item.is-disabled
&
{
color
:
$grey-4
;
}
}
// Toggle button used to expand or collapse the submenu associated with a menu
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment