Commit dddc8253 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Refactor `AdderToolbar` buttons to use `Button` instead of `ButtonBase`

parent 3a8f8c04
import {
AnnotateIcon,
ButtonBase,
Button,
HighlightIcon,
PointerDownIcon,
PointerUpIcon,
......@@ -76,10 +76,8 @@ function ToolbarButton({
const title = shortcut ? `${label} (${shortcut})` : label;
return (
<ButtonBase
<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>
);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment