diff options
author | 2021-09-14 19:58:52 +0200 | |
---|---|---|
committer | 2021-09-14 19:58:52 +0200 | |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /packages/forms/src/button/index.tsx | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'packages/forms/src/button/index.tsx')
-rw-r--r-- | packages/forms/src/button/index.tsx | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/packages/forms/src/button/index.tsx b/packages/forms/src/button/index.tsx index 48fb61635..c9ae47d55 100644 --- a/packages/forms/src/button/index.tsx +++ b/packages/forms/src/button/index.tsx | |||
@@ -227,44 +227,38 @@ class ButtonComponent extends Component<IProps> { | |||
227 | </> | 227 | </> |
228 | ); | 228 | ); |
229 | 229 | ||
230 | let wrapperComponent: JSX.Element; | 230 | const wrapperComponent = !href ? ( |
231 | 231 | <button | |
232 | if (!href) { | 232 | id={id} |
233 | wrapperComponent = ( | 233 | type={type} |
234 | <button | 234 | onClick={onClick} |
235 | id={id} | 235 | className={classnames({ |
236 | type={type} | 236 | [`${classes.button}`]: true, |
237 | onClick={onClick} | 237 | [`${classes[buttonType as ButtonType]}`]: true, |
238 | className={classnames({ | 238 | [`${classes.disabled}`]: disabled, |
239 | [`${classes.button}`]: true, | 239 | [`${className}`]: className, |
240 | [`${classes[buttonType as ButtonType]}`]: true, | 240 | })} |
241 | [`${classes.disabled}`]: disabled, | 241 | disabled={disabled} |
242 | [`${className}`]: className, | 242 | data-type="franz-button" |
243 | })} | 243 | > |
244 | disabled={disabled} | 244 | {content} |
245 | data-type="franz-button" | 245 | </button> |
246 | > | 246 | ) : ( |
247 | {content} | 247 | <a |
248 | </button> | 248 | href={href} |
249 | ); | 249 | target={target} |
250 | } else { | 250 | onClick={onClick} |
251 | wrapperComponent = ( | 251 | className={classnames({ |
252 | <a | 252 | [`${classes.button}`]: true, |
253 | href={href} | 253 | [`${classes[buttonType as ButtonType]}`]: true, |
254 | target={target} | 254 | [`${className}`]: className, |
255 | onClick={onClick} | 255 | })} |
256 | className={classnames({ | 256 | rel={target === '_blank' ? 'noopener' : ''} |
257 | [`${classes.button}`]: true, | 257 | data-type="franz-button" |
258 | [`${classes[buttonType as ButtonType]}`]: true, | 258 | > |
259 | [`${className}`]: className, | 259 | {content} |
260 | })} | 260 | </a> |
261 | rel={target === '_blank' ? 'noopener' : ''} | 261 | ); |
262 | data-type="franz-button" | ||
263 | > | ||
264 | {content} | ||
265 | </a> | ||
266 | ); | ||
267 | } | ||
268 | 262 | ||
269 | return wrapperComponent; | 263 | return wrapperComponent; |
270 | } | 264 | } |