Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions packages/lib/src/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import BadgePropsType from "./types";
import DxcFlex from "../flex/Flex";
import CoreTokens from "../common/coreTokens";
import DxcIcon from "../icon/Icon";
import DxcTooltip from "../tooltip/Tooltip";

const contextualColorMap = {
grey: {
Expand Down Expand Up @@ -92,23 +93,24 @@ const DxcBadge = ({
size = "medium",
}: BadgePropsType): JSX.Element => {
return (
<BadgeContainer
label={label}
mode={mode}
color={(mode === "contextual" && color) || undefined}
size={size}
title={title}
aria-label={title}
>
{(mode === "contextual" && (
<DxcFlex gap="0.125rem" alignItems="center">
{icon && (
<IconContainer size={size}>{typeof icon === "string" ? <DxcIcon icon={icon} /> : icon}</IconContainer>
)}
<Label label={label} notificationLimit={notificationLimit} size={size} />
</DxcFlex>
)) || <Label label={label} notificationLimit={notificationLimit} size={size} />}
</BadgeContainer>
<DxcTooltip label={title}>
<BadgeContainer
label={label}
mode={mode}
color={(mode === "contextual" && color) || undefined}
size={size}
aria-label={title}
>
{(mode === "contextual" && (
<DxcFlex gap="0.125rem" alignItems="center">
{icon && (
<IconContainer size={size}>{typeof icon === "string" ? <DxcIcon icon={icon} /> : icon}</IconContainer>
)}
<Label label={label} notificationLimit={notificationLimit} size={size} />
</DxcFlex>
)) || <Label label={label} notificationLimit={notificationLimit} size={size} />}
</BadgeContainer>
</DxcTooltip>
);
};

Expand Down