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
dddc8253
Commit
dddc8253
authored
May 25, 2023
by
Lyza Danger Gardner
Committed by
Lyza Gardner
May 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor `AdderToolbar` buttons to use `Button` instead of `ButtonBase`
parent
3a8f8c04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
AdderToolbar.tsx
src/annotator/components/AdderToolbar.tsx
+17
-8
adder-test.js
src/annotator/test/adder-test.js
+1
-1
No files found.
src/annotator/components/AdderToolbar.tsx
View file @
dddc8253
import
{
AnnotateIcon
,
Button
Base
,
Button
,
HighlightIcon
,
PointerDownIcon
,
PointerUpIcon
,
...
...
@@ -76,10 +76,8 @@ function ToolbarButton({
const
title
=
shortcut
?
`
${
label
}
(
${
shortcut
}
)`
:
label
;
return
(
<
Button
Base
<
Button
classes=
{
classnames
(
'flex-col gap-y-1 py-2.5 px-2'
,
'text-annotator-sm leading-none'
,
// Default color when the toolbar is not hovered
'text-grey-7'
,
// When the parent .group element is hovered (but this element itself is
...
...
@@ -93,11 +91,22 @@ function ToolbarButton({
)
}
onClick=
{
onClick
}
title=
{
title
}
size=
"custom"
variant=
"custom"
>
{
Icon
&&
<
Icon
className=
"text-annotator-lg"
title=
{
title
}
/>
}
{
typeof
badgeCount
===
'number'
&&
<
NumberIcon
badgeCount=
{
badgeCount
}
/>
}
<
span
>
{
label
}
</
span
>
</
ButtonBase
>
<
div
className=
{
classnames
(
'flex flex-col items-center gap-y-1 py-2.5 px-2'
,
'text-annotator-sm leading-none'
)
}
>
{
Icon
&&
<
Icon
className=
"text-annotator-lg"
title=
{
title
}
/>
}
{
typeof
badgeCount
===
'number'
&&
(
<
NumberIcon
badgeCount=
{
badgeCount
}
/>
)
}
<
span
data
-
testid=
"adder-button-label"
>
{
label
}
</
span
>
</
div
>
</
Button
>
);
}
...
...
src/annotator/test/adder-test.js
View file @
dddc8253
...
...
@@ -143,7 +143,7 @@ describe('Adder', () => {
it
(
"calls onAnnotate callback when Annotate button's label is clicked"
,
()
=>
{
const
annotateLabel
=
getContent
(
adder
).
querySelector
(
'button[title^="Annotate"]
> span
'
'button[title^="Annotate"]
[data-testid="adder-button-label"]
'
);
annotateLabel
.
dispatchEvent
(
new
Event
(
'click'
,
{
bubbles
:
true
}));
assert
.
called
(
adderCallbacks
.
onAnnotate
);
...
...
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