fix: rtl issue in breadcrumb (#21054)

* fix: rtl issue in breadcrumb

* update snapshots

* resolve ci
This commit is contained in:
Saeed Rahimi 2020-01-21 17:31:53 +03:30 committed by 偏右
parent 6378d16e19
commit 0dd9d44229
3 changed files with 24 additions and 3 deletions

View File

@ -119,7 +119,7 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
});
};
renderBreadcrumb = ({ getPrefixCls }: ConfigConsumerProps) => {
renderBreadcrumb = ({ getPrefixCls, direction }: ConfigConsumerProps) => {
let crumbs;
const {
prefixCls: customizePrefixCls,
@ -154,9 +154,12 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
});
});
}
const breadcrumbClassName = classNames(className, prefixCls, {
[`${prefixCls}-rtl`]: direction === 'rtl',
});
return (
<div
className={classNames(className, prefixCls)}
className={breadcrumbClassName}
style={style}
{...omit(restProps, ['itemRender', 'linkRender', 'nameRender', 'params'])}
>

View File

@ -34,7 +34,7 @@ exports[`Breadcrumb filter React.Fragment 1`] = `
exports[`Breadcrumb rtl render component should be rendered correctly in RTL direction 1`] = `
<div
class="ant-breadcrumb"
class="ant-breadcrumb ant-breadcrumb-rtl"
/>
`;

View File

@ -9,6 +9,14 @@
color: @breadcrumb-base-color;
font-size: @breadcrumb-font-size;
&-rtl {
direction: rtl;
> span {
float: right;
}
}
.@{iconfont-css-prefix} {
font-size: @breadcrumb-icon-font-size;
}
@ -40,12 +48,22 @@
&-link {
> .@{iconfont-css-prefix} + span {
margin-left: 4px;
.@{breadcrumb-prefix-cls}-rtl & {
margin-right: 4px;
margin-left: 0;
}
}
}
&-overlay-link {
> .@{iconfont-css-prefix} {
margin-left: 4px;
.@{breadcrumb-prefix-cls}-rtl & {
margin-right: 4px;
margin-left: 0;
}
}
}
}