Skip to content

Commit

Permalink
fix: Input with suffix align issue (#22603)
Browse files Browse the repository at this point in the history
* fix: Input prefix style

* update snapshot

* fix int
  • Loading branch information
zombieJ committed Mar 25, 2020
1 parent fbdfd4a commit e95603b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
36 changes: 36 additions & 0 deletions components/input/__tests__/__snapshots__/demo.test.js.snap
Expand Up @@ -890,6 +890,42 @@ exports[`renders ./components/input/demo/align.md correctly 1`] = `
</span>
</span>
</span>
<span
class="ant-input-affix-wrapper"
style="width:50px"
>
<input
class="ant-input"
type="text"
value=""
/>
<span
class="ant-input-suffix"
>
Y
</span>
</span>
<input
class="ant-input"
style="width:50px"
type="text"
value=""
/>
<span
class="ant-input-affix-wrapper"
style="width:50px"
>
<input
class="ant-input"
type="text"
value="1"
/>
<span
class="ant-input-suffix"
>
Y
</span>
</span>
</div>
`;

Expand Down
7 changes: 7 additions & 0 deletions components/input/demo/align.md
Expand Up @@ -28,6 +28,10 @@ const RadioGroup = Radio.Group;
const Option = Select.Option;
const { MonthPicker, RangePicker } = DatePicker;

const narrowStyle = {
width: 50,
};

const options = [
{
value: 'zhejiang',
Expand Down Expand Up @@ -94,6 +98,9 @@ ReactDOM.render(
<AutoComplete style={{ width: 100 }} placeholder="input here" />
<br />
<Input prefix="$" addonBefore="Http://" addonAfter=".com" defaultValue="mysite" />
<Input style={narrowStyle} suffix="Y" />
<Input style={narrowStyle} />
<Input style={narrowStyle} defaultValue="1" suffix="Y" />
</div>,
mountNode,
);
Expand Down
6 changes: 6 additions & 0 deletions components/input/style/affix.less
Expand Up @@ -17,6 +17,12 @@
box-shadow: none;
}
}

&::before {
width: 0;
visibility: hidden;
content: '\a0';
}
}

&-prefix,
Expand Down

0 comments on commit e95603b

Please sign in to comment.