From 3c9f6f1f9d44ac484e0e76f5cd0563f76461ca9b Mon Sep 17 00:00:00 2001 From: Santhosh C Date: Wed, 18 May 2022 23:33:07 +0530 Subject: Remove duplicated Button.js component (#176) --- src/components/ui/button/index.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/components/ui/button') diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx index 11369dcbd..9c64e909a 100644 --- a/src/components/ui/button/index.tsx +++ b/src/components/ui/button/index.tsx @@ -30,12 +30,17 @@ interface IProps extends IFormField, WithStylesProps { icon?: string; href?: string; target?: string; + htmlForm?: string; } let buttonTransition: string = 'none'; let loaderContainerTransition: string = 'none'; -if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { +if ( + typeof window !== 'undefined' && + window && + window.matchMedia('(prefers-reduced-motion: no-preference)') +) { buttonTransition = 'background .5s, opacity 0.3s'; loaderContainerTransition = 'all 0.3s'; } @@ -187,10 +192,10 @@ class ButtonComponent extends Component { icon, href, target, + htmlForm, } = this.props; const { busy } = this.state; - let showLoader = false; if (loaded) { showLoader = !loaded; @@ -235,6 +240,7 @@ class ButtonComponent extends Component { })} disabled={disabled} data-type="franz-button" + {...(htmlForm && { form: htmlForm })} > {content} @@ -259,6 +265,6 @@ class ButtonComponent extends Component { } } -export const Button = injectStyle(styles, { injectTheme: true })( - ButtonComponent, -); +const Button = injectStyle(styles, { injectTheme: true })(ButtonComponent); + +export default Button; -- cgit v1.2.3-70-g09d2