diff options
author | 2022-05-18 23:33:07 +0530 | |
---|---|---|
committer | 2022-05-18 13:03:07 -0500 | |
commit | 3c9f6f1f9d44ac484e0e76f5cd0563f76461ca9b (patch) | |
tree | e39a37a28846cda6ca30baf0a74663b97932751e /src/components/ui/button/index.tsx | |
parent | 6.0.0-nightly.40 [skip ci] (diff) | |
download | ferdium-app-3c9f6f1f9d44ac484e0e76f5cd0563f76461ca9b.tar.gz ferdium-app-3c9f6f1f9d44ac484e0e76f5cd0563f76461ca9b.tar.zst ferdium-app-3c9f6f1f9d44ac484e0e76f5cd0563f76461ca9b.zip |
Remove duplicated Button.js component (#176)
Diffstat (limited to 'src/components/ui/button/index.tsx')
-rw-r--r-- | src/components/ui/button/index.tsx | 16 |
1 files changed, 11 insertions, 5 deletions
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<typeof styles> { | |||
30 | icon?: string; | 30 | icon?: string; |
31 | href?: string; | 31 | href?: string; |
32 | target?: string; | 32 | target?: string; |
33 | htmlForm?: string; | ||
33 | } | 34 | } |
34 | 35 | ||
35 | let buttonTransition: string = 'none'; | 36 | let buttonTransition: string = 'none'; |
36 | let loaderContainerTransition: string = 'none'; | 37 | let loaderContainerTransition: string = 'none'; |
37 | 38 | ||
38 | if (window && window.matchMedia('(prefers-reduced-motion: no-preference)')) { | 39 | if ( |
40 | typeof window !== 'undefined' && | ||
41 | window && | ||
42 | window.matchMedia('(prefers-reduced-motion: no-preference)') | ||
43 | ) { | ||
39 | buttonTransition = 'background .5s, opacity 0.3s'; | 44 | buttonTransition = 'background .5s, opacity 0.3s'; |
40 | loaderContainerTransition = 'all 0.3s'; | 45 | loaderContainerTransition = 'all 0.3s'; |
41 | } | 46 | } |
@@ -187,10 +192,10 @@ class ButtonComponent extends Component<IProps> { | |||
187 | icon, | 192 | icon, |
188 | href, | 193 | href, |
189 | target, | 194 | target, |
195 | htmlForm, | ||
190 | } = this.props; | 196 | } = this.props; |
191 | 197 | ||
192 | const { busy } = this.state; | 198 | const { busy } = this.state; |
193 | |||
194 | let showLoader = false; | 199 | let showLoader = false; |
195 | if (loaded) { | 200 | if (loaded) { |
196 | showLoader = !loaded; | 201 | showLoader = !loaded; |
@@ -235,6 +240,7 @@ class ButtonComponent extends Component<IProps> { | |||
235 | })} | 240 | })} |
236 | disabled={disabled} | 241 | disabled={disabled} |
237 | data-type="franz-button" | 242 | data-type="franz-button" |
243 | {...(htmlForm && { form: htmlForm })} | ||
238 | > | 244 | > |
239 | {content} | 245 | {content} |
240 | </button> | 246 | </button> |
@@ -259,6 +265,6 @@ class ButtonComponent extends Component<IProps> { | |||
259 | } | 265 | } |
260 | } | 266 | } |
261 | 267 | ||
262 | export const Button = injectStyle(styles, { injectTheme: true })( | 268 | const Button = injectStyle(styles, { injectTheme: true })(ButtonComponent); |
263 | ButtonComponent, | 269 | |
264 | ); | 270 | export default Button; |