Skip to content

Commit

Permalink
fix: change props spread order
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed May 20, 2024
1 parent a7576c6 commit 45116a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ const ButtonWithHandlers = React.forwardRef<HTMLElement, ButtonProps>(function B
component,
{
...commonProps,
...restProps,
...extraProps,
ref,
tabIndex: disabled ? undefined : 0,
role: 'button',
'aria-disabled': disabled,
'aria-pressed': selected,
...restProps,
...extraProps,
},
content,
);
Expand All @@ -170,15 +170,15 @@ const ButtonWithHandlers = React.forwardRef<HTMLElement, ButtonProps>(function B
return (
<a
{...commonProps}
{...linkProps}
{...(extraProps as React.AnchorHTMLAttributes<HTMLAnchorElement>)}
ref={ref as React.Ref<HTMLAnchorElement>}
rel={
linkProps.target === '_blank' && !linkProps.rel
? 'noopener noreferrer'
: linkProps.rel
}
aria-disabled={disabled}
{...linkProps}
{...(extraProps as React.AnchorHTMLAttributes<HTMLAnchorElement>)}
>
{content}
</a>
Expand All @@ -189,12 +189,12 @@ const ButtonWithHandlers = React.forwardRef<HTMLElement, ButtonProps>(function B
return (
<button
{...commonProps}
{...buttonProps}
{...(extraProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}
ref={ref as React.Ref<HTMLButtonElement>}
type={buttonProps.type ?? 'button'}
disabled={disabled}
aria-pressed={selected}
{...buttonProps}
{...(extraProps as React.ButtonHTMLAttributes<HTMLButtonElement>)}
>
{content}
</button>
Expand Down

0 comments on commit 45116a9

Please sign in to comment.