Support events with external join

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-10-22 16:11:30 +02:00
parent 775f6b1d2b
commit 04d0b812f0
6 changed files with 31 additions and 7 deletions

View File

@@ -24,6 +24,8 @@ interface IButton extends Pick<
text?: React.ReactNode;
/** Makes the button into a navlink, if provided. */
to?: string;
/** Makes the button into an anchor, if provided. */
href?: string;
/** Styles the button visually with a predefined theme. */
theme?: ButtonThemes;
}
@@ -40,6 +42,7 @@ const Button = React.forwardRef<HTMLButtonElement, IButton>(({
text,
theme = 'secondary',
to,
href,
type = 'button',
className,
...props
@@ -87,6 +90,14 @@ const Button = React.forwardRef<HTMLButtonElement, IButton>(({
);
}
if (href) {
return (
<a href={href} target='_blank' rel='noopener' tabIndex={-1} className='inline-flex'>
{renderButton()}
</a>
);
}
return renderButton();
});