Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Tabs): allow string for TabItem counter value #1989

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/components/Tabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ LANDING_BLOCK-->

### Tabs.Item properties

| Name | Description | Type | Default |
| :------- | ------------------------------ | :------------------------: | :-----: |
| id | Tab ID | `string` | |
| title | Tab title | `string` `React.ReactNode` | |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string already includes in ReactNode type

| meta | Tab description | `string` | |
| hint | HTML title attribute | `string` | |
| icon | Icon displayed at the start | `React.ReactNode` | |
| counter | Number displayed at the end | `React.ReactNode` | |
| label | `<Label>` displayed at the end | `React.ReactNode` | |
| disabled | Inactive state | `boolean` | |
| Name | Description | Type | Default |
| :------- | ------------------------------ | :---------------: | :-----: |
| id | Tab ID | `string` | |
| title | Tab title | `React.ReactNode` | |
| meta | Tab description | `string` | |
| hint | HTML title attribute | `string` | |
| icon | Icon displayed at the start | `React.ReactNode` | |
| counter | Number displayed at the end | `number` `string` | |
| label | `<Label>` displayed at the end | `React.ReactNode` | |
| disabled | Inactive state | `boolean` | |

## Properties

Expand Down
6 changes: 3 additions & 3 deletions src/components/Tabs/TabsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ type ExtraProps = Omit<
export interface TabsItemProps {
id: string;
className?: string;
title: string | React.ReactNode;
title: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is html title, it could have only type string

meta?: string;
hint?: string;
active?: boolean;
disabled?: boolean;
hasOverflow?: boolean;
icon?: React.ReactNode;
counter?: number;
counter?: number | string;
label?: {
content: React.ReactNode;
theme?: LabelProps['theme'];
Expand Down Expand Up @@ -100,7 +100,7 @@ export function TabsItem({
<div className={b('item-content')}>
{icon && <div className={b('item-icon')}>{icon}</div>}
<div className={b('item-title')}>{title || id}</div>
{typeof counter === 'number' && <div className={b('item-counter')}>{counter}</div>}
{counter !== undefined && <div className={b('item-counter')}>{counter}</div>}
{label && (
<Label className={b('item-label')} theme={label.theme}>
{label.content}
Expand Down
Loading