Skip to content

Commit dfcb2d8

Browse files
committed
fix: hide the chip if value or label is not there
1 parent 780d3e8 commit dfcb2d8

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/Shared/Components/FilterChips/FilterChips.component.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ const FilterChip = ({
1818
const valueToDisplay = getFormattedValue(label, value) ?? value
1919

2020
return (
21-
<div className="flexbox flex-align-center br-4 dc__border dc__bg-n50 pl-6 pr-6 pt-2 pb-2 dc__user-select-none h-24 dc__gap-6 fs-12 lh-20 cn-9 fw-4 dc__ellipsis-right">
22-
<span className="fw-6 dc__capitalize">{labelToDisplay}</span>
23-
<span className="dc__divider h-24" />
24-
<span className="dc__ellipsis-right">{valueToDisplay}</span>
25-
<button
26-
type="button"
27-
className="flex p-0 dc__transparent"
28-
onClick={removeFilter}
29-
aria-label="Remove filter"
30-
>
31-
<CloseIcon className="icon-dim-12 icon-use-fill-n6" />
32-
</button>
33-
</div>
21+
labelToDisplay &&
22+
valueToDisplay && (
23+
<div className="flexbox flex-align-center br-4 dc__border dc__bg-n50 pl-6 pr-6 pt-2 pb-2 dc__user-select-none h-24 dc__gap-6 fs-12 lh-20 cn-9 fw-4 dc__ellipsis-right">
24+
<span className="fw-6 dc__capitalize">{labelToDisplay}</span>
25+
<span className="dc__divider h-24" />
26+
<span className="dc__ellipsis-right">{valueToDisplay}</span>
27+
<button
28+
type="button"
29+
className="flex p-0 dc__transparent"
30+
onClick={removeFilter}
31+
aria-label="Remove filter"
32+
>
33+
<CloseIcon className="icon-dim-12 icon-use-fill-n6" />
34+
</button>
35+
</div>
36+
)
3437
)
3538
}
3639

0 commit comments

Comments
 (0)