@@ -24,6 +24,7 @@ const FilterChip = ({
24
24
handleRemoveFilter,
25
25
getFormattedLabel = noop ,
26
26
getFormattedValue = noop ,
27
+ showRemoveIcon,
27
28
} : FilterChipProps ) => {
28
29
const removeFilter = ( ) => {
29
30
handleRemoveFilter ( label , value )
@@ -40,14 +41,16 @@ const FilterChip = ({
40
41
< span className = "fw-6 dc__capitalize" > { labelToDisplay } </ span >
41
42
< span className = "dc__divider h-24" />
42
43
< span className = "dc__ellipsis-right" > { valueToDisplay } </ span >
43
- < button
44
- type = "button"
45
- className = "flex p-0 dc__transparent"
46
- onClick = { removeFilter }
47
- aria-label = "Remove filter"
48
- >
49
- < CloseIcon className = "icon-dim-12 icon-use-fill-n6" />
50
- </ button >
44
+ { showRemoveIcon && (
45
+ < button
46
+ type = "button"
47
+ className = "flex p-0 dc__transparent dc__hover-n50 br-4"
48
+ onClick = { removeFilter }
49
+ aria-label = "Remove filter"
50
+ >
51
+ < CloseIcon className = "icon-dim-12 icon-use-fill-n6" />
52
+ </ button >
53
+ ) }
51
54
</ div >
52
55
)
53
56
)
@@ -64,6 +67,7 @@ const FilterChips = <T = Record<string, unknown>,>({
64
67
getFormattedValue,
65
68
className = '' ,
66
69
clearButtonClassName = '' ,
70
+ showClearAndRemove = true ,
67
71
} : FilterChipsProps < T > ) => {
68
72
const handleRemoveFilter = ( filterKey , valueToRemove ) => {
69
73
const updatedFilterConfig = JSON . parse ( JSON . stringify ( filterConfig ) )
@@ -95,6 +99,7 @@ const FilterChips = <T = Record<string, unknown>,>({
95
99
handleRemoveFilter = { handleRemoveFilter }
96
100
getFormattedLabel = { getFormattedLabel }
97
101
getFormattedValue = { getFormattedValue }
102
+ showRemoveIcon = { showClearAndRemove }
98
103
/>
99
104
) )
100
105
) : (
@@ -105,18 +110,21 @@ const FilterChips = <T = Record<string, unknown>,>({
105
110
handleRemoveFilter = { handleRemoveFilter }
106
111
getFormattedLabel = { getFormattedLabel }
107
112
getFormattedValue = { getFormattedValue }
113
+ showRemoveIcon = { showClearAndRemove }
108
114
/>
109
115
) ,
110
116
) }
111
- < div className = "flex" >
112
- < button
113
- type = "button"
114
- className = { `cta text fs-13-imp lh-20-imp h-20 p-0-imp ${ clearButtonClassName } ` }
115
- onClick = { clearFilters }
116
- >
117
- Clear All Filters
118
- </ button >
119
- </ div >
117
+ { showClearAndRemove && (
118
+ < div className = "flex" >
119
+ < button
120
+ type = "button"
121
+ className = { `cta text fs-13-imp lh-20-imp h-20 p-0-imp ${ clearButtonClassName } ` }
122
+ onClick = { clearFilters }
123
+ >
124
+ Clear All Filters
125
+ </ button >
126
+ </ div >
127
+ ) }
120
128
</ div >
121
129
)
122
130
)
0 commit comments