Skip to content

Commit

Permalink
feat(components): Update Chip.Prefix to conditionally render based on…
Browse files Browse the repository at this point in the history
… content presence
  • Loading branch information
demoraesgui committed Sep 17, 2024
1 parent 165f302 commit e86679b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/components/src/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const Chip = ({
const prefix = useChildComponent(children, d => d.type === Chip.Prefix);
const suffix = useChildComponent(children, d => d.type === Chip.Suffix);

const prefixHasContent = !!prefix?.props?.children;

const [labelRef, labelFullyVisible] = useInView<HTMLSpanElement>();
const [headingRef, headingFullyVisible] = useInView<HTMLSpanElement>();
const tooltipMessage = getTooltipMessage(
Expand All @@ -59,7 +61,7 @@ export const Chip = ({
data-testid={testID}
type="button"
>
{prefix}
{prefixHasContent && prefix}
<div className={styles.chipContent}>
{heading && (
<>
Expand Down

0 comments on commit e86679b

Please sign in to comment.