style: add anchor rtl (#22875)

This commit is contained in:
xrkffgg 2020-04-07 10:55:36 +08:00 committed by GitHub
parent 8dbaf66c2b
commit 934fe16690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 2 deletions

View File

@ -274,7 +274,7 @@ export default class Anchor extends React.Component<AnchorProps, AnchorState> {
} }
}; };
renderAnchor = ({ getPrefixCls }: ConfigConsumerProps) => { renderAnchor = ({ getPrefixCls, direction }: ConfigConsumerProps) => {
const { const {
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
className = '', className = '',
@ -298,7 +298,9 @@ export default class Anchor extends React.Component<AnchorProps, AnchorState> {
visible: activeLink, visible: activeLink,
}); });
const wrapperClass = classNames(className, `${prefixCls}-wrapper`); const wrapperClass = classNames(className, `${prefixCls}-wrapper`, {
[`${prefixCls}-rtl`]: direction === 'rtl',
});
const anchorClass = classNames(prefixCls, { const anchorClass = classNames(prefixCls, {
fixed: !affix && !showInkInFixed, fixed: !affix && !showInkInFixed,

View File

@ -80,3 +80,5 @@
padding-bottom: 5px; padding-bottom: 5px;
} }
} }
@import './rtl';

View File

@ -0,0 +1,40 @@
@import '../../style/themes/index';
@import '../../style/mixins/index';
@anchor-border-width: 2px;
.@{ant-prefix}-anchor {
&-rtl {
direction: rtl;
}
&-wrapper {
.@{ant-prefix}-anchor-rtl& {
margin-right: -4px;
margin-left: 0;
padding-right: 4px;
padding-left: 0;
}
}
&-ink {
.@{ant-prefix}-anchor-rtl & {
right: 0;
left: auto;
}
&-ball {
.@{ant-prefix}-anchor-rtl & {
right: 50%;
left: 0;
transform: translateX(50%);
}
}
}
&-link {
.@{ant-prefix}-anchor-rtl & {
padding: 7px 16px 7px 0;
}
}
}