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
classnames
from
'classnames'
;
import
type
{
Bucket
}
from
'../util/buckets'
;
import
type
{
Bucket
}
from
'../util/buckets'
;
...
@@ -61,25 +61,18 @@ export default function Buckets({
...
@@ -61,25 +61,18 @@ export default function Buckets({
// The background is set to low opacity when the sidebar is collapsed.
// The background is set to low opacity when the sidebar is collapsed.
'bg-grey-2 sidebar-collapsed:bg-black/[.08]'
,
'bg-grey-2 sidebar-collapsed:bg-black/[.08]'
,
// Disable pointer events along the sidebar itself; re-enable them in
// Disable pointer events along the sidebar itself; re-enable them in
//
bucket indicator
buttons
//
the list elements containing bucket
buttons
'pointer-events-none'
'pointer-events-none'
)
}
)
}
>
>
{
showUpNavigation
&&
(
{
showUpNavigation
&&
(
<
li
<
li
className=
"absolute right-0 pointer-events-auto"
className=
"absolute right-0 pointer-events-auto
mt-[-11px]
"
style=
{
{
top
:
above
.
position
}
}
style=
{
{
top
:
above
.
position
}
}
>
>
<
LabeledButton
<
PointerButton
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]'
)
}
data
-
testid=
"up-navigation-button"
data
-
testid=
"up-navigation-button"
direction=
"up"
onClick=
{
()
=>
onClick=
{
()
=>
onScrollToClosestOffScreenAnchor
([...
above
.
tags
],
'up'
)
onScrollToClosestOffScreenAnchor
([...
above
.
tags
],
'up'
)
}
}
...
@@ -90,22 +83,17 @@ export default function Buckets({
...
@@ -90,22 +83,17 @@ export default function Buckets({
title=
{
`Go up to next annotations (${above.tags.size})`
}
title=
{
`Go up to next annotations (${above.tags.size})`
}
>
>
{
above
.
tags
.
size
}
{
above
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
</
li
>
)
}
)
}
{
buckets
.
map
((
bucket
,
index
)
=>
(
{
buckets
.
map
((
bucket
,
index
)
=>
(
<
li
<
li
className=
"absolute right-0 pointer-events-auto"
className=
"absolute right-0 pointer-events-auto
mt-[-8px]
"
key=
{
index
}
key=
{
index
}
style=
{
{
top
:
bucket
.
position
}
}
style=
{
{
top
:
bucket
.
position
}
}
>
>
<
LabeledButton
<
PointerButton
className=
{
classnames
(
direction=
"left"
'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]'
)
}
onClick=
{
event
=>
onClick=
{
event
=>
onSelectAnnotations
(
onSelectAnnotations
(
[...
bucket
.
tags
],
[...
bucket
.
tags
],
...
@@ -119,7 +107,7 @@ export default function Buckets({
...
@@ -119,7 +107,7 @@ export default function Buckets({
title=
{
`Select nearby annotations (${bucket.tags.size})`
}
title=
{
`Select nearby annotations (${bucket.tags.size})`
}
>
>
{
bucket
.
tags
.
size
}
{
bucket
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
</
li
>
))
}
))
}
{
showDownNavigation
&&
(
{
showDownNavigation
&&
(
...
@@ -127,9 +115,9 @@ export default function Buckets({
...
@@ -127,9 +115,9 @@ export default function Buckets({
className=
"absolute right-0 pointer-events-auto"
className=
"absolute right-0 pointer-events-auto"
style=
{
{
top
:
below
.
position
}
}
style=
{
{
top
:
below
.
position
}
}
>
>
<
LabeledButton
<
PointerButton
className=
"BucketButton DownBucketButton right-0"
data
-
testid=
"down-navigation-button"
data
-
testid=
"down-navigation-button"
direction=
"down"
onClick=
{
()
=>
onClick=
{
()
=>
onScrollToClosestOffScreenAnchor
([...
below
.
tags
],
'down'
)
onScrollToClosestOffScreenAnchor
([...
below
.
tags
],
'down'
)
}
}
...
@@ -140,7 +128,7 @@ export default function Buckets({
...
@@ -140,7 +128,7 @@ export default function Buckets({
title=
{
`Go up to next annotations (${below.tags.size})`
}
title=
{
`Go up to next annotations (${below.tags.size})`
}
>
>
{
below
.
tags
.
size
}
{
below
.
tags
.
size
}
</
Labeled
Button
>
</
Pointer
Button
>
</
li
>
</
li
>
)
}
)
}
</
ul
>
</
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