Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add rtl.less of InputNumber #22434

Merged
merged 2 commits into from Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2,7 +2,7 @@

exports[`InputNumber rtl render component should be rendered correctly in RTL direction 1`] = `
<div
class="ant-input-number"
class="ant-input-number ant-input-number-rtl"
>
<div
class="ant-input-number-handler-wrap"
Expand Down
3 changes: 2 additions & 1 deletion components/input-number/index.tsx
Expand Up @@ -54,7 +54,7 @@ export default class InputNumber extends React.Component<InputNumberProps, any>
this.inputNumberRef.blur();
}

renderInputNumber = ({ getPrefixCls }: ConfigConsumerProps) => {
renderInputNumber = ({ getPrefixCls, direction }: ConfigConsumerProps) => {
const { className, size: customizeSize, prefixCls: customizePrefixCls, ...others } = this.props;
const prefixCls = getPrefixCls('input-number', customizePrefixCls);
const upIcon = <UpOutlined className={`${prefixCls}-handler-up-inner`} />;
Expand All @@ -68,6 +68,7 @@ export default class InputNumber extends React.Component<InputNumberProps, any>
{
[`${prefixCls}-lg`]: mergeSize === 'large',
[`${prefixCls}-sm`]: mergeSize === 'small',
[`${prefixCls}-rtl`]: direction === 'rtl',
},
className,
);
Expand Down
2 changes: 2 additions & 0 deletions components/input-number/style/index.less
Expand Up @@ -182,3 +182,5 @@
color: @disabled-color;
}
}

@import './rtl';
24 changes: 24 additions & 0 deletions components/input-number/style/rtl.less
@@ -0,0 +1,24 @@
@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@input-number-prefix-cls: ~'@{ant-prefix}-input-number';

.@{input-number-prefix-cls} {
&-handler-wrap {
.@{input-number-prefix-cls}-rtl & {
right: auto;
left: 0;
border-right: @border-width-base @border-style-base @input-number-handler-border-color;
border-left: 0;
border-radius: @border-radius-base 0 0 @border-radius-base;
}
}

&-input {
.@{input-number-prefix-cls}-rtl & {
direction: rtl;
text-align: right;
}
}
}