diff options
Diffstat (limited to 'src/components/ui/button/index.tsx')
-rw-r--r-- | src/components/ui/button/index.tsx | 20 |
1 files changed, 13 insertions, 7 deletions
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'; | |||
2 | import classnames from 'classnames'; | 2 | import classnames from 'classnames'; |
3 | import { Property } from 'csstype'; | 3 | import { Property } from 'csstype'; |
4 | import { Component, MouseEvent } from 'react'; | 4 | import { Component, MouseEvent } from 'react'; |
5 | import injectStyle, { WithStylesProps } from 'react-jss'; | 5 | import withStyles, { WithStylesProps } from 'react-jss'; |
6 | import Loader from 'react-loader'; | 6 | import Loader from 'react-loader'; |
7 | 7 | ||
8 | import { Theme } from '../../../themes'; | 8 | import { Theme } from '../../../themes'; |
@@ -18,6 +18,7 @@ type ButtonType = | |||
18 | 18 | ||
19 | interface IProps extends IFormField, WithStylesProps<typeof styles> { | 19 | interface IProps extends IFormField, WithStylesProps<typeof styles> { |
20 | className?: string; | 20 | className?: string; |
21 | label?: string; | ||
21 | disabled?: boolean; | 22 | disabled?: boolean; |
22 | id?: string; | 23 | id?: string; |
23 | type?: 'button' | 'reset' | 'submit' | undefined; | 24 | type?: 'button' | 'reset' | 'submit' | undefined; |
@@ -148,12 +149,19 @@ const styles = (theme: Theme) => ({ | |||
148 | }); | 149 | }); |
149 | 150 | ||
150 | class ButtonComponent extends Component<IProps> { | 151 | class ButtonComponent extends Component<IProps> { |
151 | public static defaultProps = { | 152 | customDefaultProps: { |
153 | disabled: boolean; | ||
154 | type: 'button' | 'reset' | 'submit' | undefined; | ||
155 | onClick: ( | ||
156 | event: MouseEvent<HTMLButtonElement> | MouseEvent<HTMLAnchorElement>, | ||
157 | ) => void; | ||
158 | buttonType: ButtonType; | ||
159 | busy: boolean; | ||
160 | } = { | ||
152 | type: 'button', | 161 | type: 'button', |
153 | disabled: false, | 162 | disabled: false, |
154 | onClick: () => null, | 163 | onClick: () => null, |
155 | buttonType: 'primary' as ButtonType, | 164 | buttonType: 'primary' as ButtonType, |
156 | stretch: false, | ||
157 | busy: false, | 165 | busy: false, |
158 | }; | 166 | }; |
159 | 167 | ||
@@ -193,7 +201,7 @@ class ButtonComponent extends Component<IProps> { | |||
193 | href, | 201 | href, |
194 | target, | 202 | target, |
195 | htmlForm, | 203 | htmlForm, |
196 | } = this.props; | 204 | } = { ...this.customDefaultProps, ...this.props }; |
197 | 205 | ||
198 | const { busy } = this.state; | 206 | const { busy } = this.state; |
199 | let showLoader = false; | 207 | let showLoader = false; |
@@ -265,6 +273,4 @@ class ButtonComponent extends Component<IProps> { | |||
265 | } | 273 | } |
266 | } | 274 | } |
267 | 275 | ||
268 | const Button = injectStyle(styles, { injectTheme: true })(ButtonComponent); | 276 | export default withStyles(styles, { injectTheme: true })(ButtonComponent); |
269 | |||
270 | export default Button; | ||