From f4fe25453b3a23396bb32fd88d858ae380ad33de Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Thu, 24 May 2018 16:03:37 -0700 Subject: [PATCH] Simplify EuiFormControlLayout styles. --- .../form_controls/form_control_layout.js | 1 - .../form_control_layout.test.js.snap | 122 ++++++++++-------- .../_form_control_layout.scss | 19 +-- .../form_control_layout.js | 32 ++--- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src-docs/src/views/form_controls/form_control_layout.js b/src-docs/src/views/form_controls/form_control_layout.js index 0873a67a7ce..d63f24ae602 100644 --- a/src-docs/src/views/form_controls/form_control_layout.js +++ b/src-docs/src/views/form_controls/form_control_layout.js @@ -100,7 +100,6 @@ export default () => ( {} }} icon="search" diff --git a/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.js.snap b/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.js.snap index 203f606c297..42d6a76a15b 100644 --- a/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.js.snap +++ b/src/components/form/form_control_layout/__snapshots__/form_control_layout.test.js.snap @@ -15,7 +15,7 @@ exports[`EuiFormControlLayout props clear onClick is rendered 1`] = ` class="euiFormControlLayout" >
`; @@ -81,26 +85,30 @@ exports[`EuiFormControlLayout props icon is rendered as an object 1`] = `
- + + + + + +
`; @@ -108,25 +116,29 @@ exports[`EuiFormControlLayout props icon side left is rendered 1`] = `
- + + + + + +
`; @@ -135,7 +147,7 @@ exports[`EuiFormControlLayout props icon side right is rendered 1`] = ` class="euiFormControlLayout" >
- {optionalClear} - {optionalLoader} {optionalIcon}
); } - let optionalRightIcons; + let rightIcons; - if (optionalClear || optionalLoader) { - optionalRightIcons = ( -
+ // If the icon is on the right, it should be placed after the clear button in the DOM. + if (optionalClear || optionalLoader || optionalIconSide === 'right') { + rightIcons = ( +
{optionalClear} {optionalLoader} + {optionalIconSide === 'right' ? optionalIcon : undefined}
); } + return ( - {optionalIcon} - {optionalRightIcons} + {leftIcons} + {rightIcons} ); }