File tree 3 files changed +35
-0
lines changed
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const StyledDiv = styled.div`
32
32
align-items: center;
33
33
flex-wrap: wrap;
34
34
padding: 36px 36px;
35
+ overflow: scroll;
35
36
background: ${ ( props ) => props . theme . klerosUIComponentsLightBackground } ;
36
37
transition: background ease
37
38
${ ( props ) => props . theme . klerosUIComponentsTransitionSpeed } ;
Original file line number Diff line number Diff line change @@ -51,13 +51,27 @@ const StyledDot = styled(Dot)`
51
51
margin-right: 8px;
52
52
` ;
53
53
54
+ const CountDisplay = styled . label `
55
+ width: 24px;
56
+ height: 24px;
57
+ border: 1px solid ${ ( { theme } ) => theme . klerosUIComponentsPrimaryBlue } ;
58
+ border-radius: 100%;
59
+
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+
64
+ font-size: 12px;
65
+ color: ${ ( { theme } ) => theme . klerosUIComponentsPrimaryBlue } ;
66
+ ` ;
54
67
export interface IBaseItem
55
68
extends IItem ,
56
69
Omit < React . HTMLAttributes < HTMLDivElement > , "onClick" > {
57
70
text : string ;
58
71
Icon ?: React . FC < React . SVGAttributes < SVGElement > > ;
59
72
icon ?: React . ReactNode ;
60
73
dot ?: string ;
74
+ childrenCount ?: number ;
61
75
onClick ?: ( ) => void ;
62
76
}
63
77
@@ -67,6 +81,7 @@ const BaseItem: React.FC<IBaseItem> = ({
67
81
icon,
68
82
dot,
69
83
onClick,
84
+ childrenCount,
70
85
...props
71
86
} ) => (
72
87
< Item
@@ -76,6 +91,11 @@ const BaseItem: React.FC<IBaseItem> = ({
76
91
{ icon ?? ( Icon && < Icon className = "item-icon" /> ) }
77
92
{ dot && < StyledDot color = { dot } /> }
78
93
< StyledText > { text } </ StyledText >
94
+ { childrenCount !== undefined ? (
95
+ < CountDisplay className = "count-display" >
96
+ < span > { childrenCount } </ span >
97
+ </ CountDisplay >
98
+ ) : null }
79
99
</ Item >
80
100
) ;
81
101
Original file line number Diff line number Diff line change @@ -16,6 +16,19 @@ export const StyledBaseItem = styled(BaseItem)`
16
16
? theme . klerosUIComponentsPrimaryBlue
17
17
: theme . klerosUIComponentsStroke } ;
18
18
}
19
+
20
+ .count-display {
21
+ position: absolute;
22
+ right: 32px;
23
+ border-color: ${ ( { selected, theme } ) =>
24
+ selected
25
+ ? theme . klerosUIComponentsPrimaryBlue
26
+ : theme . klerosUIComponentsStroke } ;
27
+ color: ${ ( { selected, theme } ) =>
28
+ selected
29
+ ? theme . klerosUIComponentsPrimaryBlue
30
+ : theme . klerosUIComponentsStroke } ;
31
+ }
19
32
` ;
20
33
21
34
export interface IItem {
@@ -42,6 +55,7 @@ const ItemContainer: React.FC<IItemContainer> = ({
42
55
text = { item . label }
43
56
Icon = { item . children && LightArrow }
44
57
onClick = { ( ) => onChange ( item ) }
58
+ childrenCount = { item . children ?. length }
45
59
selected = { item . value === layer . selected }
46
60
/>
47
61
) ) }
You can’t perform that action at this time.
0 commit comments