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
352f75ad
Commit
352f75ad
authored
Jan 23, 2023
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Jan 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Buckets to use shared PointerButton component
parent
c130bdc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
25 deletions
+13
-25
Buckets.tsx
src/annotator/components/Buckets.tsx
+13
-25
No files found.
src/annotator/components/Buckets.tsx
View file @
352f75ad
import
{
LabeledButton
}
from
'@hypothesis/frontend-shared
'
;
import
{
PointerButton
}
from
'@hypothesis/frontend-shared/lib/next
'
;
import
classnames
from
'classnames'
;
import
type
{
Bucket
}
from
'../util/buckets'
;
...
...
@@ -61,25 +61,18 @@ export default function Buckets({
// The background is set to low opacity when the sidebar is collapsed.
'bg-grey-2 sidebar-collapsed:bg-black/[.08]'
,
// Disable pointer events along the sidebar itself; re-enable them in
//
bucket indicator
buttons
//
the list elements containing bucket
buttons
'pointer-events-none'
)
}
>
{
showUpNavigation
&&
(
<
li
className=
"absolute right-0 pointer-events-auto"
className=
"absolute right-0 pointer-events-auto
mt-[-11px]
"
style=
{
{
top
:
above
.
position
}
}
>
<
LabeledButton
className=
{
classnames
(
'BucketButton UpBucketButton'
,
// Center the button vertically at `above.position` by pulling
// its top margin up by about half the button's height.
// This puts it nearer the toolbar's other buttons above the
// bucket list.
'right-0 mt-[-11px]'
)
}
<
PointerButton
data
-
testid=
"up-navigation-button"
direction=
"up"
onClick=
{
()
=>
onScrollToClosestOffScreenAnchor
([...
above
.
tags
],
'up'
)
}
...
...
@@ -90,22 +83,17 @@ export default function Buckets({
title=
{
`Go up to next annotations (${above.tags.size})`
}
>
{
above
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
)
}
{
buckets
.
map
((
bucket
,
index
)
=>
(
<
li
className=
"absolute right-0 pointer-events-auto"
className=
"absolute right-0 pointer-events-auto
mt-[-8px]
"
key=
{
index
}
style=
{
{
top
:
bucket
.
position
}
}
>
<
LabeledButton
className=
{
classnames
(
'BucketButton LeftBucketButton'
,
// Center the bucket indicator button vertically on `bucket.position`
// by pulling it by half the height of the button
'right-0 mt-[-8px]'
)
}
<
PointerButton
direction=
"left"
onClick=
{
event
=>
onSelectAnnotations
(
[...
bucket
.
tags
],
...
...
@@ -119,7 +107,7 @@ export default function Buckets({
title=
{
`Select nearby annotations (${bucket.tags.size})`
}
>
{
bucket
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
))
}
{
showDownNavigation
&&
(
...
...
@@ -127,9 +115,9 @@ export default function Buckets({
className=
"absolute right-0 pointer-events-auto"
style=
{
{
top
:
below
.
position
}
}
>
<
LabeledButton
className=
"BucketButton DownBucketButton right-0"
<
PointerButton
data
-
testid=
"down-navigation-button"
direction=
"down"
onClick=
{
()
=>
onScrollToClosestOffScreenAnchor
([...
below
.
tags
],
'down'
)
}
...
...
@@ -140,7 +128,7 @@ export default function Buckets({
title=
{
`Go up to next annotations (${below.tags.size})`
}
>
{
below
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
)
}
</
ul
>
...
...
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