Skip to content

Commit a1e23aa

Browse files
loadingCounters and counter issue fix
1 parent cad862b commit a1e23aa

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/UnderlineNav2/UnderlineNav.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ export const UnderlineNav = forwardRef(
407407
{loadingCounters ? (
408408
<LoadingCounter />
409409
) : (
410-
<CounterLabel>{actionElementProps.counter}</CounterLabel>
410+
actionElementProps.counter !== undefined && (
411+
<CounterLabel>{actionElementProps.counter}</CounterLabel>
412+
)
411413
)}
412414
</Box>
413415
</ActionList.Item>

src/UnderlineNav2/UnderlineNavItem.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type UnderlineNavItemProps = {
4242
/**
4343
* Counter
4444
*/
45-
counter?: number
45+
counter?: number | string
4646
} & SxProp &
4747
LinkProps
4848

@@ -175,11 +175,9 @@ export const UnderlineNavItem = forwardRef(
175175
{children}
176176
</Box>
177177
)}
178-
{counter && (
179-
<Box as="span" data-component="counter" sx={counterStyles}>
180-
{loadingCounters ? <LoadingCounter /> : <CounterLabel>{counter}</CounterLabel>}
181-
</Box>
182-
)}
178+
<Box as="span" data-component="counter" sx={counterStyles}>
179+
{loadingCounters ? <LoadingCounter /> : counter !== undefined && <CounterLabel>{counter}</CounterLabel>}
180+
</Box>
183181
</Box>
184182
</Box>
185183
</Box>

src/UnderlineNav2/examples.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ export const withCounterLabels = () => {
7272
)
7373
}
7474

75-
const items: {navigation: string; icon: React.FC<IconProps>; counter?: number}[] = [
75+
const items: {navigation: string; icon: React.FC<IconProps>; counter?: number | string}[] = [
7676
{navigation: 'Code', icon: CodeIcon},
77-
{navigation: 'Issues', icon: IssueOpenedIcon, counter: 120},
78-
{navigation: 'Pull Requests', icon: GitPullRequestIcon, counter: 13},
77+
{navigation: 'Issues', icon: IssueOpenedIcon, counter: 0},
78+
{navigation: 'Pull Requests', icon: GitPullRequestIcon, counter: '12K'},
7979
{navigation: 'Discussions', icon: CommentDiscussionIcon, counter: 5},
8080
{navigation: 'Actions', icon: PlayIcon, counter: 4},
8181
{navigation: 'Projects', icon: ProjectIcon, counter: 9},

0 commit comments

Comments
 (0)