mirror of
https://github.com/zhigang1992/react.git
synced 2026-05-16 08:29:44 +08:00
Merge pull request #155 from unix/status-color
fix: prevent main color change in special types
This commit is contained in:
@@ -55,7 +55,7 @@ exports[`Note should work with different styles 1`] = `
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
border: 1px solid #0070f3;
|
||||
color: #fff;
|
||||
color: white;
|
||||
background-color: #0070f3;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ const getStatusColor = (type: NormalTypes, filled: boolean, theme: ZeitUIThemes)
|
||||
borderColor: statusColor || theme.palette.border,
|
||||
bgColor: theme.palette.background,
|
||||
}
|
||||
|
||||
const filledColor = statusColor ? 'white' : theme.palette.background
|
||||
return {
|
||||
color: theme.palette.background,
|
||||
color: filledColor,
|
||||
borderColor: statusColor || theme.palette.foreground,
|
||||
bgColor: statusColor || theme.palette.foreground,
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ exports[`UseToast should work with different types 1`] = `
|
||||
align-items: center;
|
||||
color: #000;
|
||||
background-color: #0070f3;
|
||||
color: #fff;
|
||||
color: white;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
padding: 16pt;
|
||||
|
||||
@@ -39,13 +39,18 @@ const getColors = (palette: ZeitUIThemesPalette, type?: NormalTypes) => {
|
||||
warning: palette.warning,
|
||||
error: palette.error,
|
||||
}
|
||||
if (!type || type === 'default') return {
|
||||
const isDefault = !type || type === 'default'
|
||||
if (isDefault) return {
|
||||
bgColor: colors.default,
|
||||
color: palette.foreground,
|
||||
}
|
||||
/**
|
||||
* Prevent main color change in special types.
|
||||
* The color will only follow the theme when it is in the default type.
|
||||
*/
|
||||
return {
|
||||
bgColor: colors[type],
|
||||
color: palette.background,
|
||||
bgColor: colors[type as NormalTypes],
|
||||
color: 'white',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user