fix: update DatePicker style (#40768)

This commit is contained in:
MadCcc 2023-02-17 12:04:35 +08:00 committed by GitHub
parent 12a734adac
commit 40abef340a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ export type PickerPanelToken = {
pickerDateHoverRangeBorderColor: string;
pickerBasicCellHoverWithRangeColor: string;
pickerPanelWithoutTimeCellHeight: number;
pickerDatePanelPaddingHorizontal: number;
pickerYearMonthCellWidth: number;
pickerTimePanelColumnHeight: number;
pickerTimePanelColumnWidth: number;
@ -327,9 +328,10 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
pickerTimePanelCellHeight,
controlItemBgActive,
marginXXS,
pickerDatePanelPaddingHorizontal,
} = token;
const pickerPanelWidth = pickerPanelCellWidth * 7 + paddingSM * 2 + 4;
const pickerPanelWidth = pickerPanelCellWidth * 7 + pickerDatePanelPaddingHorizontal * 2;
const commonHoverCellFixedDistance =
(pickerPanelWidth - paddingXS * 2) / 3 - pickerYearMonthCellWidth - paddingSM;
@ -400,6 +402,7 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
border: 0,
cursor: 'pointer',
transition: `color ${motionDurationMid}`,
fontSize: 'inherit',
},
'> button': {
@ -765,7 +768,7 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
// ====================== Date Panel ======================
'&-date-panel': {
[`${componentCls}-body`]: {
padding: `${paddingXS}px ${paddingSM}px`,
padding: `${paddingXS}px ${pickerDatePanelPaddingHorizontal}px`,
},
[`${componentCls}-content`]: {
@ -1435,7 +1438,8 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
export const initPickerPanelToken = (token: TokenWithCommonCls<GlobalToken>): PickerPanelToken => {
const pickerTimePanelCellHeight = 28;
const { componentCls, controlHeightLG, controlHeightSM, colorPrimary, paddingXXS } = token;
const { componentCls, controlHeightLG, controlHeightSM, colorPrimary, paddingXXS, padding } =
token;
return {
pickerCellCls: `${componentCls}-cell`,
@ -1451,10 +1455,11 @@ export const initPickerPanelToken = (token: TokenWithCommonCls<GlobalToken>): Pi
pickerTimePanelColumnWidth: controlHeightLG * 1.4,
pickerTimePanelCellHeight,
pickerQuarterPanelContentHeight: controlHeightLG * 1.4,
pickerCellPaddingVertical: paddingXXS,
pickerCellPaddingVertical: paddingXXS + paddingXXS / 2,
pickerCellBorderGap: 2, // Magic for gap between cells
pickerControlIconSize: 7,
pickerControlIconBorderWidth: 1.5,
pickerDatePanelPaddingHorizontal: padding + paddingXXS / 2, // 18 in normal
};
};