-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
Adding even more props here to pass through to the children is a clear sign this should be refactored into a compositional API.
Originally posted by @david-crespo in #1750 (comment)
This is getting to be too many props.
console/libs/ui/lib/modal/Modal.tsx
Lines 115 to 151 in 2b3d519
| Modal.Footer = ({ | |
| children, | |
| onDismiss, | |
| onAction, | |
| actionType = 'primary', | |
| actionText, | |
| actionLoading, | |
| cancelText, | |
| disabled = false, | |
| }: { | |
| children?: React.ReactNode | |
| onDismiss: () => void | |
| onAction: () => void | |
| actionType?: 'primary' | 'danger' | |
| actionText: React.ReactNode | |
| actionLoading?: boolean | |
| cancelText?: string | |
| disabled?: boolean | |
| }) => ( | |
| <footer className="flex items-center justify-between border-t px-3 py-3 border-secondary"> | |
| <div className="mr-4">{children}</div> | |
| <div className="space-x-2"> | |
| <Button variant="secondary" size="sm" onClick={onDismiss}> | |
| {cancelText || 'Cancel'} | |
| </Button> | |
| <Button | |
| size="sm" | |
| variant={actionType} | |
| onClick={onAction} | |
| disabled={disabled} | |
| loading={actionLoading} | |
| > | |
| {actionText} | |
| </Button> | |
| </div> | |
| </footer> | |
| ) |