Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Change element of remove button
Browse files Browse the repository at this point in the history
  • Loading branch information
lorgan3 committed Dec 5, 2023
1 parent f2c2fe7 commit 7d4d23e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const MultiValue = <Option, IsMulti extends boolean, Group extends GroupBase<Opt
onRemoveClick={onClick}
onRemoveMouseDown={onMouseDown}
onRemoveMouseUp={onMouseUp}
removeElement="div"
{...rest}
>
{children}
Expand Down
16 changes: 15 additions & 1 deletion src/components/tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@ export interface TagProps extends Omit<BoxProps, 'className' | 'size'> {
onRemoveClick?: React.MouseEventHandler;
onRemoveMouseDown?: React.MouseEventHandler;
onRemoveMouseUp?: React.MouseEventHandler;
removeElement?: React.ElementType;
size?: TagSize;
}

const Tag: GenericComponent<TagProps> = forwardRef<HTMLElement, TagProps>(
({ children, className, onRemoveClick, onRemoveMouseDown, onRemoveMouseUp, size = 'medium', ...others }, ref) => {
(
{
children,
className,
onRemoveClick,
onRemoveMouseDown,
onRemoveMouseUp,
removeElement,
size = 'medium',
...others
},
ref,
) => {
const classNames = cx(theme[`is-${size}`], theme['wrapper'], className);

const TextElement = size === 'small' ? UITextSmall : size === 'large' ? UITextDisplay : UITextBody;
Expand All @@ -40,6 +53,7 @@ const Tag: GenericComponent<TagProps> = forwardRef<HTMLElement, TagProps>(
</TextElement>
{onRemoveClick && (
<IconButton
element={removeElement}
className={theme['remove-button']}
flexShrink={0}
icon={<IconCloseSmallOutline />}
Expand Down

0 comments on commit 7d4d23e

Please sign in to comment.