From 6ce44591ba462b6908c678ea1fb2f695096a0428 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Mon, 16 Mar 2020 17:03:34 +0800 Subject: [PATCH] style: add rtl.less of breadcrumb/dropdown --- components/breadcrumb/style/index.less | 20 +------ components/breadcrumb/style/rtl.less | 33 ++++++++++++ components/dropdown/style/index.less | 45 +--------------- components/dropdown/style/rtl.less | 73 ++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 63 deletions(-) create mode 100644 components/breadcrumb/style/rtl.less create mode 100644 components/dropdown/style/rtl.less diff --git a/components/breadcrumb/style/index.less b/components/breadcrumb/style/index.less index 067881b29e..a6edbd8223 100644 --- a/components/breadcrumb/style/index.less +++ b/components/breadcrumb/style/index.less @@ -1,5 +1,6 @@ @import '../../style/themes/index'; @import '../../style/mixins/index'; +@import './rtl'; @breadcrumb-prefix-cls: ~'@{ant-prefix}-breadcrumb'; @@ -9,15 +10,6 @@ color: @breadcrumb-base-color; font-size: @breadcrumb-font-size; - &-rtl { - .clearfix; - direction: rtl; - - > span { - float: right; - } - } - .@{iconfont-css-prefix} { font-size: @breadcrumb-icon-font-size; } @@ -49,22 +41,12 @@ &-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; - } } } } diff --git a/components/breadcrumb/style/rtl.less b/components/breadcrumb/style/rtl.less new file mode 100644 index 0000000000..56b7debdcb --- /dev/null +++ b/components/breadcrumb/style/rtl.less @@ -0,0 +1,33 @@ +@import '../../style/themes/index'; +@import '../../style/mixins/index'; + +@breadcrumb-prefix-cls: ~'@{ant-prefix}-breadcrumb'; + +.@{breadcrumb-prefix-cls} { + &-rtl { + .clearfix; + direction: rtl; + + > span { + float: right; + } + } + + &-link { + > .@{iconfont-css-prefix} + span { + .@{breadcrumb-prefix-cls}-rtl & { + margin-right: 4px; + margin-left: 0; + } + } + } + + &-overlay-link { + > .@{iconfont-css-prefix} { + .@{breadcrumb-prefix-cls}-rtl & { + margin-right: 4px; + margin-left: 0; + } + } + } +} diff --git a/components/dropdown/style/index.less b/components/dropdown/style/index.less index 7ca5d6d09b..51f9d0536b 100644 --- a/components/dropdown/style/index.less +++ b/components/dropdown/style/index.less @@ -1,5 +1,6 @@ @import '../../style/themes/index'; @import '../../style/mixins/index'; +@import './rtl'; @dropdown-prefix-cls: ~'@{ant-prefix}-dropdown'; @@ -12,10 +13,6 @@ z-index: @zindex-dropdown; display: block; - &-rtl { - direction: rtl; - } - &::before { position: absolute; top: -7px; @@ -25,11 +22,6 @@ z-index: -9999; opacity: 0.0001; content: ' '; - - .@{dropdown-prefix-cls}-rtl& { - right: -7px; - left: 0; - } } &-wrap { @@ -85,10 +77,6 @@ ul, li { list-style: none; - - .@{dropdown-prefix-cls}-rtl & { - text-align: right; - } } ul { @@ -110,20 +98,11 @@ cursor: pointer; transition: all 0.3s; - .@{dropdown-prefix-cls}-rtl & { - text-align: right; - } - > .anticon:first-child, > span > .anticon:first-child { min-width: 12px; margin-right: 8px; font-size: @font-size-sm; - - .@{dropdown-prefix-cls}-rtl & { - margin-right: 0; - margin-left: 8px; - } } > a { @@ -182,21 +161,11 @@ position: absolute; right: @padding-xs; - .@{dropdown-prefix-cls}-rtl & { - right: auto; - left: @padding-xs; - } - &-icon { margin-right: 0 !important; color: @text-color-secondary; font-style: normal; .iconfont-size-under-12px(10px); - - .@{dropdown-prefix-cls}-rtl & { - margin-left: 0 !important; - transform: scaleX(-1); - } } } } @@ -209,11 +178,6 @@ &-submenu-title { padding-right: @control-padding-horizontal + @font-size-sm; - - .@{dropdown-prefix-cls}-rtl & { - padding-right: @control-padding-horizontal; - padding-left: @control-padding-horizontal + @font-size-sm; - } } &-submenu-vertical { @@ -227,13 +191,6 @@ min-width: 100%; margin-left: 4px; transform-origin: 0 0; - - .@{dropdown-prefix-cls}-rtl & { - right: 100%; - left: 0; - margin-right: 4px; - margin-left: 0; - } } &-submenu&-submenu-disabled .@{dropdown-prefix-cls}-menu-submenu-title { diff --git a/components/dropdown/style/rtl.less b/components/dropdown/style/rtl.less new file mode 100644 index 0000000000..87333ba615 --- /dev/null +++ b/components/dropdown/style/rtl.less @@ -0,0 +1,73 @@ +@import '../../style/themes/index'; +@import '../../style/mixins/index'; + +@dropdown-prefix-cls: ~'@{ant-prefix}-dropdown'; + +.@{dropdown-prefix-cls} { + &-rtl { + direction: rtl; + } + + &::before { + .@{dropdown-prefix-cls}-rtl& { + right: -7px; + left: 0; + } + } + + &-menu { + &-submenu-popup { + ul, + li { + .@{dropdown-prefix-cls}-rtl & { + text-align: right; + } + } + } + + &-item, + &-submenu-title { + .@{dropdown-prefix-cls}-rtl & { + text-align: right; + } + + > .anticon:first-child, + > span > .anticon:first-child { + .@{dropdown-prefix-cls}-rtl & { + margin-right: 0; + margin-left: 8px; + } + } + + .@{dropdown-prefix-cls}-menu-submenu-arrow { + .@{dropdown-prefix-cls}-rtl & { + right: auto; + left: @padding-xs; + } + + &-icon { + .@{dropdown-prefix-cls}-rtl & { + margin-left: 0 !important; + transform: scaleX(-1); + } + } + } + } + + &-submenu-title { + .@{dropdown-prefix-cls}-rtl & { + padding-right: @control-padding-horizontal; + padding-left: @control-padding-horizontal + @font-size-sm; + } + } + + &-submenu-vertical > & { + .@{dropdown-prefix-cls}-rtl & { + right: 100%; + left: 0; + margin-right: 4px; + margin-left: 0; + } + } + } +}