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 { import {
AnnotateIcon, AnnotateIcon,
ButtonBase, Button,
HighlightIcon, HighlightIcon,
PointerDownIcon, PointerDownIcon,
PointerUpIcon, PointerUpIcon,
...@@ -76,10 +76,8 @@ function ToolbarButton({ ...@@ -76,10 +76,8 @@ function ToolbarButton({
const title = shortcut ? `${label} (${shortcut})` : label; const title = shortcut ? `${label} (${shortcut})` : label;
return ( return (
<ButtonBase <Button
classes={classnames( 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 // Default color when the toolbar is not hovered
'text-grey-7', 'text-grey-7',
// When the parent .group element is hovered (but this element itself is // When the parent .group element is hovered (but this element itself is
...@@ -93,11 +91,22 @@ function ToolbarButton({ ...@@ -93,11 +91,22 @@ function ToolbarButton({
)} )}
onClick={onClick} onClick={onClick}
title={title} title={title}
size="custom"
variant="custom"
> >
{Icon && <Icon className="text-annotator-lg" title={title} />} <div
{typeof badgeCount === 'number' && <NumberIcon badgeCount={badgeCount} />} className={classnames(
<span>{label}</span> 'flex flex-col items-center gap-y-1 py-2.5 px-2',
</ButtonBase> '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', () => { ...@@ -143,7 +143,7 @@ describe('Adder', () => {
it("calls onAnnotate callback when Annotate button's label is clicked", () => { it("calls onAnnotate callback when Annotate button's label is clicked", () => {
const annotateLabel = getContent(adder).querySelector( const annotateLabel = getContent(adder).querySelector(
'button[title^="Annotate"] > span' 'button[title^="Annotate"] [data-testid="adder-button-label"]'
); );
annotateLabel.dispatchEvent(new Event('click', { bubbles: true })); annotateLabel.dispatchEvent(new Event('click', { bubbles: true }));
assert.called(adderCallbacks.onAnnotate); 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