Refactored and cleaned up Modal and friends
This commit is contained in:
parent
f64426fbe0
commit
00a720faa9
31 changed files with 853 additions and 787 deletions
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue