Different global configs for different alert types
Venugopal46 opened this issue · 2 comments
Venugopal46 commented
Is there a way to set different global configuration for different types of alert?
like this
<Alert
config={{
success: {
position: 'bottom-right',
timeout: 5000
},
error: {
position: 'top-right',
timeout: 'none'
}
}}
/>
remaining options will be set to defaults.
juliancwirko commented
Not for now. But you can always prepare some of the configuration objects and just use them in Alert calls like:
export const alertError = {
position: 'top-right',
timeout: 'none'
};
import { alertError } from './alertError';
Alert.error('Error msg', alertError);
But maybe this could be a good improvement, so let's leave it here for now.
Valerika commented
Hi! Сan I do this?
export const Notification = {
success: (msg, params) => {
Alert.success(msg, { ...params });
},
info: (msg, params) => {
Alert.info(msg, { ...params });
},
error: (msg, params) => {
Alert.info(msg, { ...params });
},
warning: (msg, params) => {
Alert.warning(msg, { ...params });
}
};
and then
Notification.success("test", {
position: "top-right",
beep: false,
timeout: "none",
offset: 100
});