ErrorBoundary
1 year ago
Icons
1 year ago
Notifications
1 year ago
Tabs
1 year ago
store
1 year ago
AdminDetailsPage.module.scss
1 year ago
AdminSection.tsx
1 year ago
ConfirmationDialog.tsx
1 year ago
DefaultPrimaryActionButton.tsx
1 year ago
index.tsx
1 year ago
types.ts
1 year ago
utils.ts
1 year ago
ConfirmationDialog.tsx
58 lines
| 1 | import {__} from '@wordpress/i18n' |
| 2 | import ModalDialog from '@givewp/components/AdminUI/ModalDialog'; |
| 3 | import {ErrorIcon} from './Icons'; |
| 4 | import styles from './AdminDetailsPage.module.scss' |
| 5 | |
| 6 | /** |
| 7 | * @since 4.4.0 |
| 8 | */ |
| 9 | export default function ConfirmationDialog({ |
| 10 | isOpen, |
| 11 | title, |
| 12 | handleClose, |
| 13 | handleConfirm, |
| 14 | className, |
| 15 | actionLabel, |
| 16 | children, |
| 17 | }: { |
| 18 | isOpen: boolean; |
| 19 | handleClose: () => void; |
| 20 | handleConfirm: () => void; |
| 21 | title: string; |
| 22 | className?: string; |
| 23 | actionLabel: string; |
| 24 | children: React.ReactNode; |
| 25 | }) { |
| 26 | return ( |
| 27 | <ModalDialog |
| 28 | icon={<ErrorIcon />} |
| 29 | isOpen={isOpen} |
| 30 | showHeader={true} |
| 31 | handleClose={handleClose} |
| 32 | title={title} |
| 33 | wrapperClassName={className} |
| 34 | > |
| 35 | <> |
| 36 | <div className={styles.archiveDialogContent}> |
| 37 | {children} |
| 38 | </div> |
| 39 | <div className={styles.archiveDialogButtons}> |
| 40 | <button |
| 41 | className={styles.cancelButton} |
| 42 | onClick={handleClose} |
| 43 | |
| 44 | > |
| 45 | {__('Cancel', 'give')} |
| 46 | </button> |
| 47 | <button |
| 48 | className={styles.confirmButton} |
| 49 | onClick={handleConfirm} |
| 50 | > |
| 51 | {actionLabel} |
| 52 | </button> |
| 53 | </div> |
| 54 | </> |
| 55 | </ModalDialog> |
| 56 | ); |
| 57 | } |
| 58 |