File tree 2 files changed +17
-9
lines changed
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface CommonBadgeProps extends HTMLAttributes<HTMLDivElement> {
24
24
type ?: BadgeType ;
25
25
icon ?: ImageName ;
26
26
iconDir ?: HorizontalDirection ;
27
+ ellipsisContent ?: boolean ;
27
28
}
28
29
29
30
export interface DismissibleBadge extends CommonBadgeProps {
@@ -95,6 +96,7 @@ export const Badge = ({
95
96
type,
96
97
dismissible,
97
98
onClose,
99
+ ellipsisContent = true ,
98
100
...props
99
101
} : BadgeProps ) => (
100
102
< Wrapper
@@ -110,6 +112,7 @@ export const Badge = ({
110
112
iconDir = { iconDir }
111
113
size = { size }
112
114
$state = { state }
115
+ ellipsisContent = { ellipsisContent }
113
116
>
114
117
{ text }
115
118
</ BadgeContent >
Original file line number Diff line number Diff line change @@ -21,22 +21,27 @@ const LabelContainer = styled.div<{ $hasIcon: boolean; $iconDir: HorizontalDirec
21
21
gap: ${ ( { theme } ) => theme . click . sidebar . navigation . item . default . space . gap } ;
22
22
` ;
23
23
24
+ interface IconWrapperProps {
25
+ icon ?: IconName ;
26
+ iconDir ?: HorizontalDirection ;
27
+ size ?: IconSize ;
28
+ width ?: number | string ;
29
+ height ?: number | string ;
30
+ children : ReactNode ;
31
+ ellipsisContent ?: boolean ;
32
+ }
33
+
24
34
const IconWrapper = ( {
25
35
icon,
26
36
iconDir = "start" ,
27
37
size = "sm" ,
28
38
width,
29
39
height,
30
40
children,
41
+ ellipsisContent = true ,
31
42
...props
32
- } : {
33
- icon ?: IconName ;
34
- iconDir ?: HorizontalDirection ;
35
- children : ReactNode ;
36
- size ?: IconSize ;
37
- width ?: number | string ;
38
- height ?: number | string ;
39
- } ) => {
43
+ } : IconWrapperProps ) => {
44
+ const TextWrapper = ellipsisContent ? EllipsisContent : "div" ;
40
45
return (
41
46
< LabelContainer
42
47
$hasIcon = { typeof icon === "string" }
@@ -51,7 +56,7 @@ const IconWrapper = ({
51
56
height = { height }
52
57
/>
53
58
) }
54
- < EllipsisContent > { children } </ EllipsisContent >
59
+ < TextWrapper > { children } </ TextWrapper >
55
60
{ icon && iconDir === "end" && (
56
61
< Icon
57
62
name = { icon }
You can’t perform that action at this time.
0 commit comments