Skip to content

Commit

Permalink
feat: Extract the button element
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLynn committed Jun 11, 2024
1 parent 12837dc commit ffe1c5f
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions packages/semi-ui/tabs/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
</Dropdown.Menu>
);

const button = (
<div role="presentation" className={arrowCls} onClick={(e): void => this.handleArrowClick(items, pos)}>
<Button
disabled={disabled}
icon={icon}
theme="borderless"
/>
</div>
);

const dropdownCls = cls(dropdownClassName, {
[`${cssClasses.TABS_BAR}-dropdown`]: true,
});
Expand All @@ -201,25 +211,9 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
trigger={'hover'}
disableFocusListener // prevent the panel from popping up again after clicking
>
<div role="presentation" className={arrowCls} onClick={(e): void => this.handleArrowClick(items, pos)}>
<Button
disabled={disabled}
icon={icon}
// size="small"
theme="borderless"
/>
</div>
{button}
</Dropdown>
) : (
<div role="presentation" className={arrowCls} onClick={(e): void => this.handleArrowClick(items, pos)}>
<Button
disabled={disabled}
icon={icon}
// size="small"
theme="borderless"
/>
</div>
)}
) : (button)}
</>
);
};
Expand Down

0 comments on commit ffe1c5f

Please sign in to comment.