Skip to content

Commit

Permalink
chore: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
tewarig committed Jan 28, 2025
1 parent 4f76377 commit 3bc32a1
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions packages/blade/src/components/Tabs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,11 @@ type TabsProps = {
isLazy?: boolean;
} & DataAnalyticsAttribute;

type TabItemProps = {
/**
* The label of the tab item.
*/
children?: React.ReactNode;
type TabItemCommonProps = {
/**
* The value of the tab item.
*/
value: string;
/**
* Leading element of the tab item.
* Can be used to render an Icon.
*/
leading?: IconComponent;
/**
* Trailing element of the tab item.
* Can be used to render a Badge/Counter component.
Expand All @@ -94,6 +85,32 @@ type TabItemProps = {
onClick?: (event: React.MouseEvent) => void;
};

type TabItemWithoutLeadingProps = TabItemCommonProps & {
/**
* The content of the tab item.
*/
children: React.ReactNode;
/**
* Leading element of the tab item.
* Can be used to render an Icon.
*/
leading?: undefined;
};

type TabItemWithOutChildrenProps = TabItemCommonProps & {
/**
* Leading element of the tab item.
* Can be used to render an Icon.
*/
leading: IconComponent;
/**
* The content of the tab item.
*/
children?: React.ReactNode;
};

type TabItemProps = TabItemWithoutLeadingProps | TabItemWithOutChildrenProps;

type TabPanelProps = {
/**
* The value of the tab panel. This will be used to match the selected tab.
Expand Down

0 comments on commit 3bc32a1

Please sign in to comment.