update notification utils

pull/543/head
slowbackspace 5 years ago
parent e63bc301e6
commit d8f0b341d9

@ -11,13 +11,13 @@ describe('notification utils', () => {
expect(utils.getPrimaryColor('')).toBe(null); expect(utils.getPrimaryColor('')).toBe(null);
}); });
it('get secondary color from status', () => { it('get notification bg color from status', () => {
expect(utils.getSecondaryColor('info')).toBe(colors.INFO_SECONDARY); expect(utils.getNotificationBgColor('info')).toBe(colors.INFO_LIGHT);
expect(utils.getSecondaryColor('warning')).toBe(colors.WARNING_SECONDARY); expect(utils.getNotificationBgColor('warning')).toBe(colors.WARNING_LIGHT);
expect(utils.getSecondaryColor('error')).toBe(colors.ERROR_SECONDARY); expect(utils.getNotificationBgColor('error')).toBe(colors.ERROR_LIGHT);
expect(utils.getSecondaryColor('success')).toBe(colors.SUCCESS_SECONDARY); expect(utils.getNotificationBgColor('success')).toBe(colors.SUCCESS_LIGHT);
expect(utils.getSecondaryColor('kdsjflds')).toBe(null); expect(utils.getNotificationBgColor('kdsjflds')).toBe(null);
expect(utils.getSecondaryColor('')).toBe(null); expect(utils.getNotificationBgColor('')).toBe(null);
}); });
it('get icon according to status', () => { it('get icon according to status', () => {

@ -22,20 +22,20 @@ const getPrimaryColor = type => {
return color; return color;
}; };
const getSecondaryColor = type => { const getNotificationBgColor = type => {
let color; let color;
switch (type) { switch (type) {
case 'info': case 'info':
color = colors.INFO_SECONDARY; color = colors.INFO_LIGHT;
break; break;
case 'error': case 'error':
color = colors.ERROR_SECONDARY; color = colors.ERROR_LIGHT;
break; break;
case 'warning': case 'warning':
color = colors.WARNING_SECONDARY; color = colors.WARNING_LIGHT;
break; break;
case 'success': case 'success':
color = colors.SUCCESS_SECONDARY; color = colors.SUCCESS_LIGHT;
break; break;
default: default:
color = null; color = null;
@ -46,4 +46,4 @@ const getSecondaryColor = type => {
const getIcon = type => icons[type.toUpperCase()]; const getIcon = type => icons[type.toUpperCase()];
export { getPrimaryColor, getSecondaryColor, getIcon }; export { getPrimaryColor, getNotificationBgColor, getIcon };

Loading…
Cancel
Save