From d8b3cd19bf827011c0574aa00fc2ebef6cfee1dc Mon Sep 17 00:00:00 2001 From: WORLDI <66404428+WORLDI@users.noreply.github.com> Date: Wed, 6 Jan 2021 10:43:17 +0800 Subject: [PATCH] fix(tree-select): fix the tree-select style problems (#690) fix the tree-select style problems Co-authored-by: Jack --- .../__snapshots__/tree-select.test.js.snap | 24 +++++++++---------- src/components/tree-select/iconUtil.tsx | 8 +++---- src/components/tree-select/style/index.less | 23 ++++++++---------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/components/tree-select/__tests__/__snapshots__/tree-select.test.js.snap b/src/components/tree-select/__tests__/__snapshots__/tree-select.test.js.snap index 145b428cf5..049be62e65 100644 --- a/src/components/tree-select/__tests__/__snapshots__/tree-select.test.js.snap +++ b/src/components/tree-select/__tests__/__snapshots__/tree-select.test.js.snap @@ -1184,9 +1184,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ @@ -1465,9 +1465,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ @@ -2180,9 +2180,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ @@ -2461,9 +2461,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ @@ -3182,9 +3182,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ @@ -3463,9 +3463,9 @@ initialize { "attribs": Object { "class": "gio-icon-svg", "fill": "currentColor", - "height": "12px", + "height": "16px", "viewBox": "0 0 14 14", - "width": "12px", + "width": "16px", "xmlns": "http://www.w3.org/2000/svg", }, "children": Array [ diff --git a/src/components/tree-select/iconUtil.tsx b/src/components/tree-select/iconUtil.tsx index 1b418ebcba..f6ca9126da 100644 --- a/src/components/tree-select/iconUtil.tsx +++ b/src/components/tree-select/iconUtil.tsx @@ -24,7 +24,7 @@ export default function getIcons({ // Clear Icon let mergedClearIcon = clearIcon; if (!clearIcon) { - mergedClearIcon = ; + mergedClearIcon = ; } // Arrow item icon @@ -34,7 +34,7 @@ export default function getIcons({ } else { const iconCls = `${prefixCls}-suffix`; mergedSuffixIcon = () => { - return ; + return ; }; } @@ -43,7 +43,7 @@ export default function getIcons({ if (menuItemSelectedIcon !== undefined) { mergedItemIcon = menuItemSelectedIcon; } else if (multiple) { - mergedItemIcon = ; + mergedItemIcon = ; } else { mergedItemIcon = null; } @@ -52,7 +52,7 @@ export default function getIcons({ if (removeIcon !== undefined) { mergedRemoveIcon = removeIcon; } else { - mergedRemoveIcon = ; + mergedRemoveIcon = ; } return { diff --git a/src/components/tree-select/style/index.less b/src/components/tree-select/style/index.less index e9d6c9c2c3..cfe13128c3 100644 --- a/src/components/tree-select/style/index.less +++ b/src/components/tree-select/style/index.less @@ -143,18 +143,19 @@ position: relative; display: flex; flex-wrap: wrap; + box-sizing: border-box; width: 100%; min-height: 40px; - padding: 0 8px 0 16px; + padding: 0 32px 0 16px; background-color: #fff; border: 1px solid @palette-gray-3; border-radius: 4px; - &:hover { - border: 1px solid @palette-blue-5; - } cursor: text; -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); + &:hover { + border: 1px solid @palette-blue-5; + } .@{select-prefix-cls}-selection-search { position: absolute; top: 0; @@ -193,18 +194,14 @@ } .@{select-prefix-cls}-arrow { position: absolute; - top: 53%; right: 8px; - display: inline-block; - width: 12px; - height: 12px; - margin-top: -6px; - color: inherit; - color: rgba(0, 0, 0, 0.25); + display: flex; + align-items: center; + justify-content: center; + height: 100%; + color: #a3adc8; font-size: 12px; font-style: normal; - line-height: 1; - text-align: center; text-transform: none; pointer-events: none; text-rendering: optimizeLegibility;