@@ -61,9 +61,6 @@ const IconContainer = styled.div<{
6161` ;
6262
6363const DxcChip = ( { action, disabled = false , label, margin, prefix, size = "medium" , tabIndex = 0 } : ChipPropsType ) => {
64- const isAvatarPrefix = ( prefix : ChipPropsType [ "prefix" ] ) : prefix is ChipAvatarType =>
65- typeof prefix === "object" && prefix !== null && "color" in prefix ;
66-
6764 const labelRef = useRef < HTMLSpanElement > ( null ) ;
6865 const [ showTooltip , setShowTooltip ] = useState ( false ) ;
6966
@@ -77,19 +74,19 @@ const DxcChip = ({ action, disabled = false, label, margin, prefix, size = "medi
7774 return (
7875 < Chip disabled = { disabled } margin = { margin } size = { size } >
7976 { prefix &&
80- ( isAvatarPrefix ( prefix ) && size !== "small" ? (
77+ ( typeof prefix === "string" ? (
78+ < IconContainer disabled = { disabled } >
79+ < DxcIcon icon = { prefix } />
80+ </ IconContainer >
81+ ) : prefix . color && size !== "small" ? (
8182 < DxcAvatar
82- color = { prefix . color }
83- label = { prefix . profileName }
84- icon = { prefix . icon }
85- imageSrc = { prefix . imageSrc }
83+ color = { ( prefix as ChipAvatarType ) . color }
84+ label = { ( prefix as ChipAvatarType ) . profileName }
85+ icon = { ( prefix as ChipAvatarType ) . icon }
86+ imageSrc = { ( prefix as ChipAvatarType ) . imageSrc }
8687 size = "xsmall"
8788 disabled = { disabled }
8889 />
89- ) : typeof prefix === "string" ? (
90- < IconContainer disabled = { disabled } >
91- < DxcIcon icon = { prefix } />
92- </ IconContainer >
9390 ) : (
9491 isValidElement ( prefix ) && < IconContainer disabled = { disabled } > { prefix } </ IconContainer >
9592 ) ) }
0 commit comments