feat: custom button html element

This commit is contained in:
Jacob Fletcher
2022-12-03 00:31:00 -05:00
parent 1f53990bb1
commit 5592fb148d
2 changed files with 7 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ const Button: React.FC<Props> = (props) => {
className,
id,
type = 'button',
el,
el = 'button',
to,
url,
children,
@@ -130,8 +130,10 @@ const Button: React.FC<Props> = (props) => {
);
default:
const Tag = el; // eslint-disable-line no-case-declarations
return (
<button
<Tag
type="submit"
{...buttonProps}
>
@@ -141,7 +143,7 @@ const Button: React.FC<Props> = (props) => {
>
{children}
</ButtonContents>
</button>
</Tag>
);
}
};

View File

@@ -1,10 +1,10 @@
import React, { MouseEvent } from 'react';
import React, { ElementType, MouseEvent } from 'react';
export type Props = {
className?: string,
id?: string,
type?: 'submit' | 'button',
el?: 'link' | 'anchor' | undefined,
el?: 'link' | 'anchor' | ElementType,
to?: string,
url?: string,
children?: React.ReactNode,