Refactored and cleaned up Modal and friends

This commit is contained in:
Alvaro 2022-09-29 16:40:09 -06:00 committed by GitHub
parent f64426fbe0
commit 00a720faa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 853 additions and 787 deletions

View file

@ -58,6 +58,7 @@ type PropsType = {
}
| {
type: 'submit';
form?: string;
}
) &
(
@ -117,12 +118,14 @@ export const Button = React.forwardRef<HTMLButtonElement, PropsType>(
let onClick: undefined | MouseEventHandler<HTMLButtonElement>;
let type: 'button' | 'submit';
let form;
if ('onClick' in props) {
({ onClick } = props);
type = 'button';
} else {
onClick = undefined;
({ type } = props);
({ form } = props);
}
const sizeClassName = SIZE_CLASS_NAMES.get(size);
@ -143,6 +146,7 @@ export const Button = React.forwardRef<HTMLButtonElement, PropsType>(
)}
disabled={disabled}
onClick={onClick}
form={form}
ref={ref}
style={style}
tabIndex={tabIndex}