Skip to content

Commit

Permalink
fix(Chip): missing data-component-name when closable (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
atabel authored Aug 1, 2024
1 parent 5f995ad commit e4e284f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import IconCloseRegular from './generated/mistica-icons/icon-close-regular';
import {pxToRem} from './utils/css';
import * as styles from './chip.css';
import {vars} from './skins/skin-contract.css';
import {getPrefixedDataAttributes} from './utils/dom';
import {useThemeVariant} from './theme-variant-context';
import Touchable, {BaseTouchable} from './touchable';

Expand Down Expand Up @@ -62,6 +61,8 @@ const Chip: React.FC<ChipProps> = (props: ChipProps) => {
</>
);

const chipDataAttributes = {'component-name': 'Chip', ...dataAttributes};

if (onClose) {
return (
<Box
Expand All @@ -71,7 +72,7 @@ const Chip: React.FC<ChipProps> = (props: ChipProps) => {
)}
paddingLeft={paddingLeft}
paddingRight={paddingIcon}
{...getPrefixedDataAttributes(dataAttributes, 'Chip')}
dataAttributes={chipDataAttributes}
>
{body}
<Touchable
Expand All @@ -93,8 +94,6 @@ const Chip: React.FC<ChipProps> = (props: ChipProps) => {
const isTouchable = props.href || props.onPress || props.to;
const isInteractive = active !== undefined || isTouchable;

const chipDataAttributes = {'component-name': 'Chip', ...dataAttributes};

const renderBadge = () => {
if (!badge) {
return null;
Expand Down

0 comments on commit e4e284f

Please sign in to comment.