fix(component): avoid close button of the notification being invisible in dark mode and bright bg (#6946)
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
getCardBorderColor,
|
getCardBorderColor,
|
||||||
getCardColor,
|
getCardColor,
|
||||||
getCardForegroundColor,
|
getCardForegroundColor,
|
||||||
|
getCloseIconColor,
|
||||||
getIconColor,
|
getIconColor,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ export const NotificationCard = ({ notification }: NotificationCardProps) => {
|
|||||||
[styles.cardForeground]: getCardForegroundColor(style),
|
[styles.cardForeground]: getCardForegroundColor(style),
|
||||||
[styles.actionTextColor]: getActionTextColor(style, theme),
|
[styles.actionTextColor]: getActionTextColor(style, theme),
|
||||||
[styles.iconColor]: getIconColor(style, theme, iconColor),
|
[styles.iconColor]: getIconColor(style, theme, iconColor),
|
||||||
|
[styles.closeIconColor]: getCloseIconColor(style),
|
||||||
})}
|
})}
|
||||||
data-with-icon={icon ? '' : undefined}
|
data-with-icon={icon ? '' : undefined}
|
||||||
{...rootAttrs}
|
{...rootAttrs}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export const cardForeground = createVar();
|
|||||||
export const cardBorderColor = createVar();
|
export const cardBorderColor = createVar();
|
||||||
export const actionTextColor = createVar();
|
export const actionTextColor = createVar();
|
||||||
export const iconColor = createVar();
|
export const iconColor = createVar();
|
||||||
|
export const closeIconColor = createVar();
|
||||||
|
|
||||||
export const card = style({
|
export const card = style({
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
@@ -82,7 +83,7 @@ export const closeButton = style({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
export const closeIcon = style({
|
export const closeIcon = style({
|
||||||
color: `${cardForeground} !important`,
|
color: `${closeIconColor} !important`,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const main = style({
|
export const main = style({
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const getIconColor = (
|
|||||||
theme: NotificationTheme,
|
theme: NotificationTheme,
|
||||||
iconColor?: string
|
iconColor?: string
|
||||||
) => {
|
) => {
|
||||||
if (style === 'normal') {
|
if (style !== 'alert') {
|
||||||
const map: Record<NotificationTheme, string> = {
|
const map: Record<NotificationTheme, string> = {
|
||||||
error: cssVar('errorColor'),
|
error: cssVar('errorColor'),
|
||||||
info: cssVar('processingColor'),
|
info: cssVar('processingColor'),
|
||||||
@@ -71,3 +71,9 @@ export const getIconColor = (
|
|||||||
|
|
||||||
return iconColor || cssVar('pureWhite');
|
return iconColor || cssVar('pureWhite');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getCloseIconColor = (style: NotificationStyle) => {
|
||||||
|
return style === 'alert'
|
||||||
|
? getCardForegroundColor(style)
|
||||||
|
: cssVar('iconColor');
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user