fix: button forwardRef
This commit is contained in:
parent
496404195c
commit
2715d0216c
@ -98,19 +98,29 @@ const Button = forwardRef<
|
|||||||
href,
|
href,
|
||||||
...baseLinkProps,
|
...baseLinkProps,
|
||||||
};
|
};
|
||||||
return <a {...externalLinkProps}>{_children}</a>;
|
return (
|
||||||
|
// @ts-expect-error - ref
|
||||||
|
<a ref={ref} {...externalLinkProps}>
|
||||||
|
{_children}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal link
|
// Internal link
|
||||||
return (
|
return (
|
||||||
<Link {...baseLinkProps} to={href}>
|
// @ts-expect-error - ref
|
||||||
|
<Link ref={ref} {...baseLinkProps} to={href}>
|
||||||
{_children}
|
{_children}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const { ...buttonProps } = _props;
|
const { ...buttonProps } = _props;
|
||||||
// @ts-expect-error - as prop is not a valid prop for button elements
|
return (
|
||||||
return <button {...buttonProps}>{_children}</button>;
|
// @ts-expect-error - as prop is not a valid prop for button elements
|
||||||
|
<button ref={ref} {...buttonProps}>
|
||||||
|
{_children}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
@ -161,8 +171,6 @@ const Button = forwardRef<
|
|||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
{...props}
|
{...props}
|
||||||
// @ts-expect-error - ref is not a valid prop for button elements
|
|
||||||
ref={ref}
|
|
||||||
className={buttonTheme({ ...styleProps, class: className })}
|
className={buttonTheme({ ...styleProps, class: className })}
|
||||||
>
|
>
|
||||||
{cloneIcon(leftIcon, { ...iconSize })}
|
{cloneIcon(leftIcon, { ...iconSize })}
|
||||||
|
Loading…
Reference in New Issue
Block a user