From 5592fb148dfa3058df577cfb7f5ed72ea25e1217 Mon Sep 17 00:00:00 2001 From: Jacob Fletcher Date: Sat, 3 Dec 2022 00:31:00 -0500 Subject: [PATCH] feat: custom button html element --- src/admin/components/elements/Button/index.tsx | 8 +++++--- src/admin/components/elements/Button/types.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/admin/components/elements/Button/index.tsx b/src/admin/components/elements/Button/index.tsx index 4ddfc5faa7..b098e6d60e 100644 --- a/src/admin/components/elements/Button/index.tsx +++ b/src/admin/components/elements/Button/index.tsx @@ -53,7 +53,7 @@ const Button: React.FC = (props) => { className, id, type = 'button', - el, + el = 'button', to, url, children, @@ -130,8 +130,10 @@ const Button: React.FC = (props) => { ); default: + const Tag = el; // eslint-disable-line no-case-declarations + return ( - + ); } }; diff --git a/src/admin/components/elements/Button/types.ts b/src/admin/components/elements/Button/types.ts index 2cdadc7e7b..48eaaa3afb 100644 --- a/src/admin/components/elements/Button/types.ts +++ b/src/admin/components/elements/Button/types.ts @@ -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,