mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-12 09:00:58 +00:00
update notification utils
This commit is contained in:
parent
e63bc301e6
commit
d8f0b341d9
@ -11,13 +11,13 @@ describe('notification utils', () => {
|
||||
expect(utils.getPrimaryColor('')).toBe(null);
|
||||
});
|
||||
|
||||
it('get secondary color from status', () => {
|
||||
expect(utils.getSecondaryColor('info')).toBe(colors.INFO_SECONDARY);
|
||||
expect(utils.getSecondaryColor('warning')).toBe(colors.WARNING_SECONDARY);
|
||||
expect(utils.getSecondaryColor('error')).toBe(colors.ERROR_SECONDARY);
|
||||
expect(utils.getSecondaryColor('success')).toBe(colors.SUCCESS_SECONDARY);
|
||||
expect(utils.getSecondaryColor('kdsjflds')).toBe(null);
|
||||
expect(utils.getSecondaryColor('')).toBe(null);
|
||||
it('get notification bg color from status', () => {
|
||||
expect(utils.getNotificationBgColor('info')).toBe(colors.INFO_LIGHT);
|
||||
expect(utils.getNotificationBgColor('warning')).toBe(colors.WARNING_LIGHT);
|
||||
expect(utils.getNotificationBgColor('error')).toBe(colors.ERROR_LIGHT);
|
||||
expect(utils.getNotificationBgColor('success')).toBe(colors.SUCCESS_LIGHT);
|
||||
expect(utils.getNotificationBgColor('kdsjflds')).toBe(null);
|
||||
expect(utils.getNotificationBgColor('')).toBe(null);
|
||||
});
|
||||
|
||||
it('get icon according to status', () => {
|
||||
|
@ -22,20 +22,20 @@ const getPrimaryColor = type => {
|
||||
return color;
|
||||
};
|
||||
|
||||
const getSecondaryColor = type => {
|
||||
const getNotificationBgColor = type => {
|
||||
let color;
|
||||
switch (type) {
|
||||
case 'info':
|
||||
color = colors.INFO_SECONDARY;
|
||||
color = colors.INFO_LIGHT;
|
||||
break;
|
||||
case 'error':
|
||||
color = colors.ERROR_SECONDARY;
|
||||
color = colors.ERROR_LIGHT;
|
||||
break;
|
||||
case 'warning':
|
||||
color = colors.WARNING_SECONDARY;
|
||||
color = colors.WARNING_LIGHT;
|
||||
break;
|
||||
case 'success':
|
||||
color = colors.SUCCESS_SECONDARY;
|
||||
color = colors.SUCCESS_LIGHT;
|
||||
break;
|
||||
default:
|
||||
color = null;
|
||||
@ -46,4 +46,4 @@ const getSecondaryColor = type => {
|
||||
|
||||
const getIcon = type => icons[type.toUpperCase()];
|
||||
|
||||
export { getPrimaryColor, getSecondaryColor, getIcon };
|
||||
export { getPrimaryColor, getNotificationBgColor, getIcon };
|
||||
|
Loading…
Reference in New Issue
Block a user