wp_back/wp-content/plugins/wp-smushit/_src/react/utils/notices.js

36 lines
904 B
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
export function showSuccessNotice(id, message, dismissible = true) {
return showNotice(id, message, 'success', dismissible);
}
export function showErrorNotice(id, message, dismissible = true) {
return showNotice(id, message, 'error', dismissible);
}
export function showInfoNotice(id, message, dismissible = true) {
return showNotice(id, message, 'info', dismissible);
}
export function showWarningNotice(id, message, dismissible = true) {
return showNotice(id, message, 'warning', dismissible);
}
export function closeNotice(id) {
SUI.closeNotice(id);
}
export function showNotice(id, message, type = 'success', dismissible = true) {
const icons = {
error: 'warning-alert',
info: 'info',
warning: 'warning-alert',
success: 'check-tick'
};
SUI.closeNotice(id);
SUI.openNotice(id, '<p>' + message + '</p>', {
type: type,
icon: icons[type],
dismiss: {show: dismissible}
});
}