mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
style: add divider rtl support (#23734)
* style: add divider rtl support * add base
This commit is contained in:
parent
53a76f0bf7
commit
e41340ac4d
@ -14,7 +14,7 @@ export interface DividerProps {
|
||||
|
||||
const Divider: React.FC<DividerProps> = props => (
|
||||
<ConfigConsumer>
|
||||
{({ getPrefixCls }: ConfigConsumerProps) => {
|
||||
{({ getPrefixCls, direction }: ConfigConsumerProps) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
type = 'horizontal',
|
||||
@ -29,6 +29,7 @@ const Divider: React.FC<DividerProps> = props => (
|
||||
const classString = classNames(className, prefixCls, `${prefixCls}-${type}`, {
|
||||
[`${prefixCls}-with-text${orientationPrefix}`]: children,
|
||||
[`${prefixCls}-dashed`]: !!dashed,
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
});
|
||||
return (
|
||||
<div className={classString} {...restProps} role="separator">
|
||||
|
@ -107,3 +107,5 @@
|
||||
border-width: 0 0 0 1px;
|
||||
}
|
||||
}
|
||||
|
||||
@import './rtl';
|
||||
|
36
components/divider/style/rtl.less
Normal file
36
components/divider/style/rtl.less
Normal file
@ -0,0 +1,36 @@
|
||||
@import '../../style/themes/index';
|
||||
@import '../../style/mixins/index';
|
||||
|
||||
@divider-prefix-cls: ~'@{ant-prefix}-divider';
|
||||
|
||||
.@{divider-prefix-cls} {
|
||||
&-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
&-horizontal&-with-text-left {
|
||||
&::before {
|
||||
.@{divider-prefix-cls}-rtl& {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
.@{divider-prefix-cls}-rtl& {
|
||||
width: 5%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-horizontal&-with-text-right {
|
||||
&::before {
|
||||
.@{divider-prefix-cls}-rtl& {
|
||||
width: 5%;
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
.@{divider-prefix-cls}-rtl& {
|
||||
width: 95%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user