feat: add rate direction (#23321)

* feat: add rate direction

* fix: remove css

* remove classname
This commit is contained in:
xrkffgg 2020-04-20 11:05:27 +08:00 committed by GitHub
parent fabec4831c
commit 757c57622b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 15 deletions

View File

@ -1,7 +1,6 @@
import * as React from 'react';
import RcRate from 'rc-rate';
import omit from 'omit.js';
import classNames from 'classnames';
import StarFilled from '@ant-design/icons/StarFilled';
import Tooltip from '../tooltip';
@ -54,13 +53,10 @@ export default class Rate extends React.Component<RateProps, any> {
}
renderRate = ({ getPrefixCls, direction }: ConfigConsumerProps) => {
const { prefixCls, className, ...restProps } = this.props;
const { prefixCls, ...restProps } = this.props;
const rateProps = omit(restProps, ['tooltips']);
const ratePrefixCls = getPrefixCls('rate', prefixCls);
const rateClassNames = classNames(className, {
[`${ratePrefixCls}-rtl`]: direction === 'rtl',
});
return (
<RcRate
@ -68,7 +64,7 @@ export default class Rate extends React.Component<RateProps, any> {
characterRender={this.characterRender}
{...rateProps}
prefixCls={ratePrefixCls}
className={rateClassNames}
direction={direction}
/>
);
};

View File

@ -79,7 +79,7 @@
&-text {
display: inline-block;
margin-left: 8px;
margin: 0 8px;
font-size: @font-size-base;
}
}

View File

@ -23,11 +23,4 @@
}
}
}
&-text {
.@{rate-prefix-cls}-rtl & {
margin-right: 8px;
margin-left: 0;
}
}
}

View File

@ -122,7 +122,7 @@
"rc-pagination": "~2.2.0",
"rc-picker": "~1.4.0",
"rc-progress": "~2.5.0",
"rc-rate": "~2.5.1",
"rc-rate": "~2.6.0",
"rc-resize-observer": "^0.2.0",
"rc-select": "~10.2.0",
"rc-slider": "~9.2.3",