mirror of
https://gh.wpcy.net/https://github.com/elementor/one-click-accessibility.git
synced 2026-04-23 23:22:51 +08:00
* update: convert imports to named imports * add: function to check if current screen is settings page * update: rename elementor logo to app logo * add: url mismatch flow and components * update: remove obsolete code * Update modules/connect/rest/authorize.php Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com> * Update modules/settings/module.php Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com> * fix: modal was not closing * update: remove url mismatch notice * update: mismatch modal and rendering logic * add: toast notifications for errors * update: convert components into styled components * update: remove bottom border from the dialog * update: text copy * fix: logo alignment * update: renamed styled component --------- Co-authored-by: Pavlo Kniazevych <139438463+pkniazevych@users.noreply.github.com>
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import { AlertTriangleFilledIcon } from '@elementor/icons';
|
|
import Button from '@elementor/ui/Button';
|
|
import Dialog from '@elementor/ui/Dialog';
|
|
import DialogActions from '@elementor/ui/DialogActions';
|
|
import DialogContent from '@elementor/ui/DialogContent';
|
|
import DialogHeader from '@elementor/ui/DialogHeader';
|
|
import Typography from '@elementor/ui/Typography';
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
const ConfirmDialog = ({
|
|
title,
|
|
onCancel,
|
|
onClose,
|
|
onApprove,
|
|
approveText = __('Submit', 'pojo-accessibility'),
|
|
cancelText = __('Cancel', 'pojo-accessibility'),
|
|
approveButtonColor = 'error',
|
|
approveButtonSize = 'medium',
|
|
children,
|
|
logo = <AlertTriangleFilledIcon color="error" />,
|
|
showCancelButton = true,
|
|
showApproveButton = true,
|
|
approveButtonDisabled = false,
|
|
showCloseButton = false,
|
|
dividers = false,
|
|
...props
|
|
}) => {
|
|
return (
|
|
<Dialog open onClose={onClose} {...props}>
|
|
<DialogHeader logo={logo} onClose={showCloseButton ? onClose : false}>
|
|
<Typography variant="subtitle1">{title}</Typography>
|
|
</DialogHeader>
|
|
|
|
<DialogContent dividers={dividers}>{children}</DialogContent>
|
|
|
|
<DialogActions>
|
|
{showCancelButton && (
|
|
<Button onClick={onCancel} color="secondary">
|
|
{cancelText}
|
|
</Button>
|
|
)}
|
|
{showApproveButton && (
|
|
<Button
|
|
variant="contained"
|
|
disabled={approveButtonDisabled}
|
|
color={approveButtonColor}
|
|
size={approveButtonSize}
|
|
onClick={onApprove}
|
|
>
|
|
{approveText}
|
|
</Button>
|
|
)}
|
|
</DialogActions>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
export default ConfirmDialog;
|