From 8715d489b58534470fc0d35b5961797bc0118e84 Mon Sep 17 00:00:00 2001
From: Ricardo Cino <ricardo@cino.io>
Date: Mon, 27 Jun 2022 22:27:27 +0200
Subject: chore: turn error boundary into typescript

---
 src/components/ui/button/index.tsx | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

(limited to 'src/components/ui/button/index.tsx')

diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx
index 9c64e909a..26fd6bcfe 100644
--- a/src/components/ui/button/index.tsx
+++ b/src/components/ui/button/index.tsx
@@ -2,7 +2,7 @@ import Icon from '@mdi/react';
 import classnames from 'classnames';
 import { Property } from 'csstype';
 import { Component, MouseEvent } from 'react';
-import injectStyle, { WithStylesProps } from 'react-jss';
+import withStyles, { WithStylesProps } from 'react-jss';
 import Loader from 'react-loader';
 
 import { Theme } from '../../../themes';
@@ -18,6 +18,7 @@ type ButtonType =
 
 interface IProps extends IFormField, WithStylesProps<typeof styles> {
   className?: string;
+  label?: string;
   disabled?: boolean;
   id?: string;
   type?: 'button' | 'reset' | 'submit' | undefined;
@@ -148,12 +149,19 @@ const styles = (theme: Theme) => ({
 });
 
 class ButtonComponent extends Component<IProps> {
-  public static defaultProps = {
+  customDefaultProps: {
+    disabled: boolean;
+    type: 'button' | 'reset' | 'submit' | undefined;
+    onClick: (
+      event: MouseEvent<HTMLButtonElement> | MouseEvent<HTMLAnchorElement>,
+    ) => void;
+    buttonType: ButtonType;
+    busy: boolean;
+  } = {
     type: 'button',
     disabled: false,
     onClick: () => null,
     buttonType: 'primary' as ButtonType,
-    stretch: false,
     busy: false,
   };
 
@@ -193,7 +201,7 @@ class ButtonComponent extends Component<IProps> {
       href,
       target,
       htmlForm,
-    } = this.props;
+    } = { ...this.customDefaultProps, ...this.props };
 
     const { busy } = this.state;
     let showLoader = false;
@@ -265,6 +273,4 @@ class ButtonComponent extends Component<IProps> {
   }
 }
 
-const Button = injectStyle(styles, { injectTheme: true })(ButtonComponent);
-
-export default Button;
+export default withStyles(styles, { injectTheme: true })(ButtonComponent);
-- 
cgit v1.2.3-70-g09d2

