Skip to content

Commit

Permalink
fix(button): apply startIcon prop to Button
Browse files Browse the repository at this point in the history
  • Loading branch information
LTakhyunKim committed Nov 29, 2023
1 parent a623945 commit ce99dbb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/design-system/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
icon,
className,
children,
startIcon,
...buttonProps
} = props;
const hasIconOnly = Boolean(icon && !children);
const hasIconOnly = Boolean((startIcon || icon) && !children);

return (
<>
Expand All @@ -26,7 +27,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
kind="outlined"
color={props.color ?? "primary"}
size={size}
startIcon={icon}
startIcon={startIcon || icon}
hasIconOnly={hasIconOnly}
>
{!hasIconOnly && <>{children}</>}
Expand All @@ -41,7 +42,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
kind={props.kind ?? "contained"}
color={props.color ?? "primary"}
size={size}
startIcon={icon}
startIcon={startIcon || icon}
hasIconOnly={hasIconOnly}
>
{!hasIconOnly && <>{children}</>}
Expand Down

0 comments on commit ce99dbb

Please sign in to comment.