Skip to content

Commit

Permalink
fix: input should have correct padding with controlHeight (#45048)
Browse files Browse the repository at this point in the history
* fix: input should have correct padding with controlHeight

* chore: update snapshot

* chore: update snapshot
  • Loading branch information
MadCcc committed Sep 25, 2023
1 parent 3ffe70a commit 54a2df3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 3 deletions.
4 changes: 3 additions & 1 deletion components/input/__tests__/demo-extend.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { extendTest } from '../../../tests/shared/demoTest';

extendTest('input');
extendTest('input', {
skip: ['component-token.tsx'],
});
4 changes: 3 additions & 1 deletion components/input/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as React from 'react';
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';

demoTest('input');
demoTest('input', {
skip: ['component-token.tsx'],
});

rootPropsTest(
'input',
Expand Down
7 changes: 7 additions & 0 deletions components/input/demo/component-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## zh-CN

token debug

## en-US

token debug
10 changes: 10 additions & 0 deletions components/input/demo/component-token.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { ConfigProvider, Input } from 'antd';

const App: React.FC = () => (
<ConfigProvider theme={{ token: { controlHeight: 28 } }}>
<Input placeholder="Basic usage" />
</ConfigProvider>
);

export default App;
1 change: 1 addition & 0 deletions components/input/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ A basic widget for getting the user input is a text field. Keyboard and mouse ca
<code src="./demo/align.tsx" debug>Text Align</code>
<code src="./demo/textarea-resize.tsx" debug>TextArea</code>
<code src="./demo/debug-addon.tsx" debug>debug Pre / Post tab</code>
<code src="./demo/component-token.tsx" debug>debug token</code>

## API

Expand Down
1 change: 1 addition & 0 deletions components/input/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ demo:
<code src="./demo/align.tsx" debug>文本对齐</code>
<code src="./demo/textarea-resize.tsx" debug>文本域</code>
<code src="./demo/debug-addon.tsx" debug>debug 前置/后置标签</code>
<code src="./demo/component-token.tsx" debug>debug token</code>

## API

Expand Down
2 changes: 1 addition & 1 deletion components/input/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ export const initComponentToken = (token: GlobalToken): SharedComponentToken =>
return {
paddingBlock: Math.max(
Math.round(((controlHeight - fontSize * lineHeight) / 2) * 10) / 10 - lineWidth,
3,
0,
),
paddingBlockSM: Math.max(
Math.round(((controlHeightSM - fontSize * lineHeight) / 2) * 10) / 10 - lineWidth,
Expand Down

0 comments on commit 54a2df3

Please sign in to comment.