fix: calendar panel style (#35502)

This commit is contained in:
MadCcc 2022-05-12 10:10:59 +08:00 committed by GitHub
parent 77cad90c08
commit b559a1fd1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -26,6 +26,7 @@ export const genCalendarStyles = (token: CalendarToken): CSSObject => {
token; token;
return { return {
[calendarCls]: { [calendarCls]: {
...genPanelStyle(token, calendarItemActiveBg),
...resetComponent(token), ...resetComponent(token),
background: calendarFullBg, background: calendarFullBg,
'&-rtl': { '&-rtl': {
@ -203,7 +204,7 @@ export default genComponentStyleHook(
pickerCellInnerCls: `${token.componentCls}-cell-inner`, pickerCellInnerCls: `${token.componentCls}-cell-inner`,
}); });
return [genCalendarStyles(calendarToken), genPanelStyle(calendarToken)]; return [genCalendarStyles(calendarToken)];
}, },
token => ({ token => ({
calendarFullBg: token.colorBgComponent, calendarFullBg: token.colorBgComponent,

View File

@ -49,6 +49,7 @@ const genPikerPadding = (
const genPickerCellInnerStyle = ( const genPickerCellInnerStyle = (
token: Omit<PickerToken, 'zIndexPopup'>, token: Omit<PickerToken, 'zIndexPopup'>,
cellClassName: string, cellClassName: string,
selectedCellBgColor: string = token.colorPrimary,
): CSSObject => { ): CSSObject => {
const { componentCls } = token; const { componentCls } = token;
@ -115,7 +116,7 @@ const genPickerCellInnerStyle = (
&-in-view:is(&-range-start) ${cellClassName}, &-in-view:is(&-range-start) ${cellClassName},
&-in-view:is(&-range-end) ${cellClassName}`]: { &-in-view:is(&-range-end) ${cellClassName}`]: {
color: '#fff', // FIXME: text-color-invert color: '#fff', // FIXME: text-color-invert
background: token.colorPrimary, background: selectedCellBgColor,
}, },
[`&-in-view:is(&-range-start):not(&-range-start-single), [`&-in-view:is(&-range-start):not(&-range-start-single),
@ -272,7 +273,10 @@ const genPickerCellInnerStyle = (
}; };
}; };
export const genPanelStyle = (token: Omit<PickerToken, 'zIndexPopup'>): CSSObject => { export const genPanelStyle = (
token: Omit<PickerToken, 'zIndexPopup'>,
selectedCellBgColor: string = token.colorPrimary,
): CSSObject => {
const { componentCls, pickerCellInnerCls } = token; const { componentCls, pickerCellInnerCls } = token;
const pickerArrowSize = 7; // FIXME: v4 magic number const pickerArrowSize = 7; // FIXME: v4 magic number
@ -458,7 +462,7 @@ export const genPanelStyle = (token: Omit<PickerToken, 'zIndexPopup'>): CSSObjec
color: token.colorText, color: token.colorText,
}, },
...genPickerCellInnerStyle(token, pickerCellInnerCls), ...genPickerCellInnerStyle(token, pickerCellInnerCls, selectedCellBgColor),
}, },
[`&-decade-panel, [`&-decade-panel,
@ -612,7 +616,7 @@ export const genPanelStyle = (token: Omit<PickerToken, 'zIndexPopup'>): CSSObjec
}, },
[`&-selected td, [`&-selected td,
&-selected:hover td`]: { &-selected:hover td`]: {
background: token.colorPrimary, background: token.colorPrimary,
[`&${componentCls}-cell-week`]: { [`&${componentCls}-cell-week`]: {