chore: set default value for style (#38689)

* fix: set default value for style

* Update components/tooltip/util.ts

Co-authored-by: afc163 <afc163@gmail.com>

Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
lijianan 2022-11-18 18:37:18 +08:00 committed by GitHub
parent 4f3b257521
commit 9dc33bda54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,13 +11,13 @@ export function parseColor(prefixCls: string, color?: string) {
[`${prefixCls}-${color}`]: color && PresetColorRegex.test(color),
});
let overlayStyle: React.CSSProperties | undefined;
let arrowStyle: React.CSSProperties | undefined;
const overlayStyle: React.CSSProperties = {};
const arrowStyle: React.CSSProperties = {};
if (color && !PresetColorRegex.test(color)) {
overlayStyle = { background: color };
overlayStyle.background = color;
// @ts-ignore
arrowStyle = { '--antd-arrow-background-color': color };
arrowStyle['--antd-arrow-background-color'] = color;
}
return { className, overlayStyle, arrowStyle };