Skip to content

Commit

Permalink
fix: added fix for split btn icon
Browse files Browse the repository at this point in the history
  • Loading branch information
fazil-eigthfold committed Aug 19, 2022
1 parent 98f1f70 commit 423fe84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ Split.args = {
split: true,
splitButtonChecked: false,
text: 'Split Button',
splitButtonProps: {
iconProps: {
path: IconName.mdiClockOutline,
},
},
};

Split_With_Counter.args = {
Expand Down
13 changes: 8 additions & 5 deletions src/components/Button/SplitButton/SplitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,18 @@ export const SplitButton: FC<SplitButtonProps> = React.forwardRef(
return iconSize;
};

const getButtonIconPath = (): IconName =>
iconProps?.path
? iconProps.path
: checked
? IconName.mdiChevronUp
: IconName.mdiChevronDown;

const getButtonIcon = (): JSX.Element => (
<Icon
{...iconProps}
classNames={styles.icon}
path={
iconProps?.path || checked
? IconName.mdiChevronUp
: IconName.mdiChevronDown
}
path={getButtonIconPath()}
size={getButtonIconSize()}
/>
);
Expand Down

0 comments on commit 423fe84

Please sign in to comment.