Skip to content

Commit a998a00

Browse files
765477020liuqiangafc163
authored
style: fix incorrect DatePicker small token (#53668)
Co-authored-by: liuqiang <[email protected]> Co-authored-by: afc163 <[email protected]>
1 parent 61a630a commit a998a00

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

components/date-picker/style/index.ts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,9 @@ import genVariantsStyle from './variants';
2424
export type { ComponentToken, PanelComponentToken, PickerPanelToken };
2525
export { initPickerPanelToken, initPanelComponentToken, genPanelStyle };
2626

27-
const genPickerPadding = (
28-
token: PickerToken,
29-
inputHeight: number,
30-
fontHeight: number,
31-
paddingHorizontal: number,
32-
): CSSObject => {
33-
const height = token.calc(fontHeight).add(2).equal();
34-
const paddingTop = token.max(token.calc(inputHeight).sub(height).div(2).equal(), 0);
35-
const paddingBottom = token.max(token.calc(inputHeight).sub(height).sub(paddingTop).equal(), 0);
36-
27+
const genPickerPadding = (paddingBlock: number, paddingInline: number): CSSObject => {
3728
return {
38-
padding: `${unit(paddingTop)} ${unit(paddingHorizontal)} ${unit(paddingBottom)}`,
29+
padding: `${unit(paddingBlock)} ${unit(paddingInline)}`,
3930
};
4031
};
4132

@@ -63,7 +54,6 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
6354
const {
6455
componentCls,
6556
antCls,
66-
controlHeight,
6757
paddingInline,
6858
lineWidth,
6959
lineType,
@@ -72,8 +62,10 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
7262
motionDurationMid,
7363
colorTextDisabled,
7464
colorTextPlaceholder,
75-
controlHeightLG,
7665
fontSizeLG,
66+
inputFontSizeLG,
67+
fontSizeSM,
68+
inputFontSizeSM,
7769
controlHeightSM,
7870
paddingInlineSM,
7971
paddingXS,
@@ -95,15 +87,14 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
9587
presetsMaxWidth,
9688
boxShadowPopoverArrow,
9789
fontHeight,
98-
fontHeightLG,
9990
lineHeightLG,
10091
} = token;
10192

10293
return [
10394
{
10495
[componentCls]: {
10596
...resetComponent(token),
106-
...genPickerPadding(token, controlHeight, fontHeight, paddingInline),
97+
...genPickerPadding(token.paddingBlock, token.paddingInline),
10798
position: 'relative',
10899
display: 'inline-flex',
109100
alignItems: 'center',
@@ -128,7 +119,7 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
128119
display: 'inline-block',
129120
width: '100%',
130121
color: 'inherit',
131-
fontSize: token.fontSize,
122+
fontSize: token.inputFontSize ?? token.fontSize,
132123
lineHeight: token.lineHeight,
133124
transition: `all ${motionDurationMid}`,
134125
...genPlaceholderStyle(colorTextPlaceholder),
@@ -164,16 +155,18 @@ const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
164155

165156
// Size
166157
'&-large': {
167-
...genPickerPadding(token, controlHeightLG, fontHeightLG, paddingInline),
168-
158+
...genPickerPadding(token.paddingBlockLG, token.paddingInlineLG),
169159
[`${componentCls}-input > input`]: {
170-
fontSize: fontSizeLG,
160+
fontSize: inputFontSizeLG ?? fontSizeLG,
171161
lineHeight: lineHeightLG,
172162
},
173163
},
174164

175165
'&-small': {
176-
...genPickerPadding(token, controlHeightSM, fontHeight, paddingInlineSM),
166+
...genPickerPadding(token.paddingBlockSM, token.paddingInlineSM),
167+
[`${componentCls}-input > input`]: {
168+
fontSize: inputFontSizeSM ?? fontSizeSM,
169+
},
177170
},
178171

179172
[`${componentCls}-suffix`]: {

0 commit comments

Comments
 (0)