The global header css of navigation panel was overriding the color of notifications.
Signed-off-by: Afreen Misbah <afreen@ibm.com>
-<!-- Reusable notification item template -->
<ng-template #notificationItemTemplate
let-notification="notification"
let-last="last">
<div class="notification-wrapper">
<div class="notification-item">
<div class="notification-icon">
- <cd-icon [type]="notificationIconMap[notification.type] || 'info'">
+ <cd-icon [type]="notificationIconMap[notification.type] || notificationIconMap['default']">
</cd-icon>
</div>
<div class="notification-content">
readonly notificationIconMap = {
[NotificationType.success]: 'success',
- [NotificationType.error]: 'danger',
- [NotificationType.info]: 'info',
- [NotificationType.warning]: 'warning'
+ [NotificationType.error]: 'error',
+ [NotificationType.info]: 'infoCircle',
+ [NotificationType.warning]: 'warning',
+ default: 'infoCircle'
} as const;
constructor(private notificationService: NotificationService) {}
[ngClass]="{ 'running': hasRunningTasks }"
(click)="togglePanel($event)">
<div class="notification-icon-wrapper">
- <svg cdsIcon="notification"
- size="20"
- title="notification"></svg>
+ <cd-icon type="notification"
+ size="20">
+ </cd-icon>
<span class="notification-count"
*ngIf="notificationCount > 0">
{{ notificationCount }}
@use '@carbon/styles/scss/theme';
+/*
+!important required to override the parent component's carbon css.
+
+e.g. carbon header adds following which changes colors of notification panel icons:
+
+.cds--btn.cds--btn--icon-only.cds--header__action svg {
+ fill: var(--cds-icon-secondary, #c6c6c6);
+ }
+
+Also using 'fill' as that is coming from carbon (see above example).
+Using `color` in css and seyting svg will fill="currentColor does not work.
+*/
+
.success-icon {
- color: theme.$support-success;
+ fill: theme.$support-success !important;
}
.danger-icon {
- color: theme.$support-error;
+ fill: theme.$support-error !important;
}
//@TODO: this naming needs to be changed
// Do this after converting Icons enum to const
.infoCircle-icon {
- color: theme.$support-info;
+ fill: theme.$support-info !important;
}
.warning-icon {
- color: theme.$support-caution-major;
+ fill: theme.$support-caution-major !important;
}
.error-icon {
- color: theme.$support-error;
+ fill: theme.$support-error !important;
}
.info-icon {
- color: theme.$support-info;
+ fill: theme.$support-info !important;
}
stack2x = 'fa fa-stack-2x', // To stack regularly sized icon
pulse = 'fa fa-pulse', // To have spinner rotate with 8 steps
spin = 'fa fa-spin', // To get any icon to rotate
- inverse = 'fa fa-inverse' // To get an alternative icon color
+ inverse = 'fa fa-inverse', // To get an alternative icon color
+ notification = 'notification',
+ error = 'error--filled'
}
export enum IconSize {
}
export const ICON_TYPE = {
+ check: 'check',
copy: 'copy',
danger: 'danger',
+ edit: 'edit',
+ error: 'error--filled',
infoCircle: 'info-circle',
+ notification: 'notification',
success: 'success',
- warning: 'warning',
- edit: 'edit',
- check: 'check'
+ warning: 'warning'
} as const;