mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
feat: add rate direction (#23321)
* feat: add rate direction * fix: remove css * remove classname
This commit is contained in:
parent
fabec4831c
commit
757c57622b
@ -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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
&-text {
|
||||
display: inline-block;
|
||||
margin-left: 8px;
|
||||
margin: 0 8px;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-text {
|
||||
.@{rate-prefix-cls}-rtl & {
|
||||
margin-right: 8px;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user