Skip to content

fix(GlDropdown): Add styling for search within gldropdown

Jarek Ostrowski requested to merge 976-fix-search-styling-in-dropdown into master

What does this MR do?

Problem

Currently, gl-search-box-by-type isn't being styled within a dropdown if someone were to use one in a dropdown. In the new-dropdown-with-search example, we are hard-coding an m-2 class, whereas we aren't adding this class to the search box in the with header story. This is a perfect example of the discrepancy on consistent usage of a search box within a dropdown.

Also, the current structure in the with header story is:

<gl-dropdown-text><gl-search-box-by-type /></gl-dropdown-text>

This seems to be a temporary measure to prevent the hover styles coming through when wrapping in a gl-dropdown-item wrapper (which shows a light gray background). Either way, the search box ends up getting strange styling (see corresponding issue).

Solution

This MR removes the hard-coded m-2 class on the with search example and adds CSS to target the gl-search-box-by-type so styling is out-of-the-box and no hard-coded styling is necessary for the person implementing the component. It can now be a standalone component within the dropdown, next to it's <gl-dropdown-item> and <gl-dropdown-text> brothers and sisters.

Screenshots

Before After
Screen_Shot_2020-10-06_at_10.31.07_AM Screen_Shot_2020-10-06_at_10.31.29_AM
Screen_Shot_2020-10-06_at_10.32.09_AM Screen_Shot_2020-10-06_at_10.32.35_AM

Integration MR

Does this MR meet the acceptance criteria?

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidlines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui package can be upgraded quickly after the changes are released:
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #976 (closed)

Edited by Jarek Ostrowski

Merge request reports

Loading