From 1f79c76b80b156d0fa93298b95b1111902e46d66 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 20 Mar 2020 14:43:32 +0800 Subject: [PATCH] style: add rtl.less of InputNumber (#22434) * seyle: add rtl.less of InputNumber * fix: snap --- .../__snapshots__/index.test.js.snap | 2 +- components/input-number/index.tsx | 3 ++- components/input-number/style/index.less | 2 ++ components/input-number/style/rtl.less | 24 +++++++++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 components/input-number/style/rtl.less diff --git a/components/input-number/__tests__/__snapshots__/index.test.js.snap b/components/input-number/__tests__/__snapshots__/index.test.js.snap index e0377be498..b441a6f48a 100644 --- a/components/input-number/__tests__/__snapshots__/index.test.js.snap +++ b/components/input-number/__tests__/__snapshots__/index.test.js.snap @@ -2,7 +2,7 @@ exports[`InputNumber rtl render component should be rendered correctly in RTL direction 1`] = `
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 = ; @@ -68,6 +68,7 @@ export default class InputNumber extends React.Component { [`${prefixCls}-lg`]: mergeSize === 'large', [`${prefixCls}-sm`]: mergeSize === 'small', + [`${prefixCls}-rtl`]: direction === 'rtl', }, className, ); diff --git a/components/input-number/style/index.less b/components/input-number/style/index.less index f9fe8b3b86..5cf23233ed 100644 --- a/components/input-number/style/index.less +++ b/components/input-number/style/index.less @@ -182,3 +182,5 @@ color: @disabled-color; } } + +@import './rtl'; diff --git a/components/input-number/style/rtl.less b/components/input-number/style/rtl.less new file mode 100644 index 0000000000..d4d7c74429 --- /dev/null +++ b/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; + } + } +}