Skip to content

Commit 547aeb9

Browse files
authored
Removed blank (#660)
1 parent 0d63807 commit 547aeb9

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,15 @@
11
import { tokens } from '@equinor/eds-tokens';
22
import { StyledNormalText } from '../components/filterGroup/filterGroup.styles';
33

4-
export function getFilterHeaderText(
5-
isAllChecked: boolean,
6-
name: string,
7-
checkedValues: string[]
8-
): string | JSX.Element {
4+
export function getFilterHeaderText(isAllChecked: boolean, name: string, checkedValues: string[]): JSX.Element {
95
const selectedCount = checkedValues.length;
10-
11-
const hasBlank = checkedValues.includes('(Blank)');
12-
const nonBlankCount = hasBlank ? selectedCount - 1 : selectedCount;
13-
14-
if (hasBlank && nonBlankCount > 0) {
15-
return <StyledNormalText>{`${name} (Blank) (+${nonBlankCount})`}</StyledNormalText>;
16-
}
17-
18-
if (selectedCount === 1 && hasBlank) {
19-
return <StyledNormalText>{`${name} (Blank)`}</StyledNormalText>;
20-
}
21-
226
const displayText = selectedCount > 0 ? `${name} (+${selectedCount})` : name;
237

24-
if (isAllChecked || selectedCount === 0) {
25-
return <StyledNormalText>{displayText}</StyledNormalText>;
26-
}
8+
const textComponent = <StyledNormalText>{displayText}</StyledNormalText>;
279

28-
return <div style={{ color: tokens.colors.interactive.primary__resting.hex }}>{displayText}</div>;
10+
return isAllChecked || selectedCount === 0 ? (
11+
textComponent
12+
) : (
13+
<div style={{ color: tokens.colors.interactive.primary__resting.hex }}>{displayText}</div>
14+
);
2915
}

0 commit comments

Comments
 (0)