Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiSuperSelect] With prepend and append needs it's border-radius fixed in Amsterdam #5442

Closed
cchaos opened this issue Dec 3, 2021 · 4 comments · Fixed by #5738
Closed
Assignees
Labels

Comments

@cchaos
Copy link
Contributor

cchaos commented Dec 3, 2021

Screen Shot 2021-12-03 at 13 46 42 PM

@jeepers3327
Copy link
Contributor

Hi @cchaos .

I fixed this one by adding fixed border-radius values depending whether it's prepend, append or both and attaches that style to euiFormControlLayout__childrenWrapper

const wrapperBorder = () => {
      if (append && prepend) return '0';
      if (prepend) return '0 5px 5px 0';
      if (append) return '5px 0 0 5px';
    }

return (
      <div className={classes} {...rest}>
        {prependNodes}
        <div className="euiFormControlLayout__childrenWrapper" style={{borderRadius: wrapperBorder()}}>
          {children}

          <EuiFormControlLayoutIcons
            icon={icon}
            clear={clear}
            compressed={compressed}
            isLoading={isLoading}
          />
        </div>
        {appendNodes}
      </div>
    );

Append:
image

Prepend:
image

Both:
image

I'm not sure whether there's a need for React component code change or will just to deal with it in its .scss file.
Please advised on the ideal way of fixing this.

Thanks.

@cchaos
Copy link
Contributor Author

cchaos commented Dec 6, 2021

Hi @jeepers3327. Thanks for attempting to fix this one. We definitely only want to fix this in the Sass files not the component code itself as it needs to align with our Sass tokens for border-radius and is currently where all those styles live. Eventually, we'll be converting to CSS-in-JS, but for now we don't want to separate where styles are written.

For EuiSuperSelect specifically, it has it's own set of styles for applying border-radius and so it isn't actually tied to the EuiFormControlLayout:
Screen Shot 2021-12-06 at 18 20 42 PM

And it's further tricky because this is only an issue in the Amsterdam (now default) theme. There is a specific overrides folder in our themes/amsterdam Sass folder that where these style overrides will need to be applied.

@jeepers3327
Copy link
Contributor

For EuiSuperSelect specifically, it has it's own set of styles for applying border-radius and so it isn't actually tied to the EuiFormControlLayout:

May I know which file in themes/amsterdam do I need to styles for border-radius, I'm looking for a scss file which contains euiSuperSelectControl class but I haven't find it.

@cchaos
Copy link
Contributor Author

cchaos commented Dec 7, 2021

There isn't one yet for the super select component. You can follow the pattern of this file: https://github.com/elastic/eui/blob/main/src/themes/amsterdam/overrides/_mark.scss and create a new one called _super_select.scss importing it in the index.scss file in the same folder

@cchaos cchaos self-assigned this Mar 22, 2022
cchaos pushed a commit to cchaos/eui that referenced this issue Mar 22, 2022
- Fixed EuiSuperSelect border radius with append/prepend elastic#5442
- Fixed EuiSuperSelect not respecting `readOnly` elastic#3510
cchaos added a commit that referenced this issue Mar 30, 2022
* [EuiFormControlLayout] Added `isInvalid` prop which is passed through to `EuiFormControlLayoutIcon` which renders the `alert` icon in red

* Passed the `isInvalid` through for some form controls
- EuiFieldNumber, EuiFieldPassword, EuiFieldText, EuiSelect, EuiSuperSelect
- EuiFieldSearch attempts to create a new class for the number of icons

* Added a `getFormControlClassNameForIconCount` localized service for couting icons

* Change className output from rendering component-specific to generic to reduce output syles

* [EuiFormControlLayout] Added `isDropdown` to create and control the arrow down icon

* [EuiColorPicker] Fix usage of EuiFormControlLayout to not double

* [EuiSelect] & [EuiSuperSelect] Update to new EuiFormControlLayout props
- Fixed EuiSuperSelect border radius with append/prepend #5442
- Fixed EuiSuperSelect not respecting `readOnly` #3510

* [EuiValidatableControl] Add `aria-invalid`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants