Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom icons for Confirm action buttons. #3812

Merged
merged 3 commits into from
Nov 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/ra-ui-materialui/src/layout/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const Confirm = ({
confirm,
cancel,
confirmColor,
ConfirmIcon,
CancelIcon,
onClose,
onConfirm,
classes: classesOverride,
Expand Down Expand Up @@ -98,7 +100,7 @@ const Confirm = ({
</DialogContent>
<DialogActions>
<Button disabled={loading} onClick={onClose}>
<AlertError className={classes.iconPaddingStyle} />
<CancelIcon className={classes.iconPaddingStyle} />
{translate(cancel, { _: cancel })}
</Button>
<Button
Expand All @@ -110,7 +112,7 @@ const Confirm = ({
})}
autoFocus
>
<ActionCheck className={classes.iconPaddingStyle} />
<ConfirmIcon className={classes.iconPaddingStyle} />
{translate(confirm, { _: confirm })}
</Button>
</DialogActions>
Expand All @@ -123,6 +125,8 @@ Confirm.propTypes = {
classes: PropTypes.object,
confirm: PropTypes.string.isRequired,
confirmColor: PropTypes.string.isRequired,
ConfirmIcon: PropTypes.elementType.isRequired,
CancelIcon: PropTypes.elementType.isRequired,
content: PropTypes.string.isRequired,
isOpen: PropTypes.bool,
loading: PropTypes.bool,
Expand All @@ -136,6 +140,8 @@ Confirm.defaultProps = {
classes: {},
confirm: 'ra.action.confirm',
confirmColor: 'primary',
ConfirmIcon: ActionCheck,
CancelIcon: AlertError,
isOpen: false,
};

Expand Down