Skip to content

Commit

Permalink
Update slot condition in button
Browse files Browse the repository at this point in the history
  • Loading branch information
matt416 committed Mar 4, 2025
1 parent 623af5e commit de245ed
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,28 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
type={type}
{...rest}
>
<Slottable>{children}</Slottable>

{iconOnly ? (
<LeftIcon size={iconSize} />
{children ? (
<Slottable>{children}</Slottable>
) : (
<div
className={cn(
'w-full h-full flex items-center justify-between',
gap
)}
>
<div className={cn('flex items-center justify-start', gap)}>
{LeftIcon && <LeftIcon size={iconSize} />}
<Text>{label}</Text>
</div>
<>
{iconOnly ? (
<LeftIcon size={iconSize} />
) : (
<div
className={cn(
'w-full h-full flex items-center justify-between',
gap
)}
>
<div className={cn('flex items-center justify-start', gap)}>
{LeftIcon && <LeftIcon size={iconSize} />}
<Text>{label}</Text>
</div>

{RightIcon && <RightIcon size={iconSize} />}
</div>
{RightIcon && <RightIcon size={iconSize} />}
</div>
)}
</>
)}
</Component>
)
Expand Down

0 comments on commit de245ed

Please sign in to comment.