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

[EuiHeaderLinks] Providing more flexibility in display #4046

Merged
merged 15 commits into from
Sep 22, 2020

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Sep 16, 2020

And update a lot of the Header examples.

This may look like a lot of changes, but it's because I fixed up most of the Header page examples to:

  • No longer import external doc components (like HeaderUserMenu and HeaderSpacesMenu). This would cause the CodeSandbox examples to break and really we only need to display them once (or twice) and the rest of the examples just show the button.
  • All Elastic logos instead of Kibana
  • Remove all actual links that might send the user to the index page. Basically getting ahead of some of the # fixes.

EuiHeaderLinks

Added gutterSize to adjust the spacing between direct children. And extended some props on the "mobile" version with popoverBreakpoints, popoverButtonProps, and popoverProps. And then I used the EuiHideFor and EuiShowFor to render/not render the inline links versus the popover version depending on the popoverBreakpoints
instead of using CSS media queries which are hard to adjust at the consumer level.


EuiHide/ShowFor adjustment

As an extra ease of use for the EuiHideFor and EuiShowFor components, I'm allowing the sizes prop also accept the strings all and none.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs
  • Added documentation
  • Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

cchaos added 8 commits September 16, 2020 19:24
- No importing of external doc examples
- All Elastic logos
- Remove all actual links that might send the user to the index page
- Only the first example shows all the popovers
- The Full screen demo has the rest
Then update `popoverBreakpoints` prop in EuiHeaderLinks to also allow for `all` and `none`.
@cchaos cchaos force-pushed the flexing/header_links branch from cf00811 to e74cc24 Compare September 16, 2020 23:24
Comment on lines -13 to -15
import HeaderAppMenu from './header_app_menu';
import HeaderUserMenu from './header_user_menu';
import HeaderSpacesMenu from './header_spaces_menu';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these imports to to be directly declared in this file. Now the CodeSandbox works 🎉

src-docs/src/views/header/header.js Show resolved Hide resolved

import HeaderUserMenu from './header_user_menu';
import HeaderSpacesMenu from './header_spaces_menu';
import HeaderUpdates from './header_updates';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again moved the HeaderUpdates component directly in this file. It still needs an actual example all on its own, but that will take time.

src/components/popover/popover.tsx Show resolved Hide resolved
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4046/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! 🎉

I looked at the code and tested the docs and sandboxes. I just added a suggestion to replace the <Link> from react-router-dom.

src-docs/src/views/header/header.js Show resolved Hide resolved
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4046/

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change requested.

Also, I'm curious what the use case for all/none in show/hide is? Seems like it would be easier to not include the content at all (when wanting to never show or always hide) or not wrap with a show/hide tag when it should always be included.

src/components/header/header_links/header_links.tsx Outdated Show resolved Hide resolved
@cchaos
Copy link
Contributor Author

cchaos commented Sep 18, 2020

Also, I'm curious what the use case for all/none in show/hide is? Seems like it would be easier to not include the content at all (when wanting to never show or always hide) or not wrap with a show/hide tag when it should always be included.

I agree that it seems odd to allow such a value, but I found that it makes it much easier (on the EUI side) to support the inclusion or exclusion of responsive breakpoints entirely. So in EuiHeaderLinks, I can allow customization of when to show/hide the popover version via:

popoverBreakpoints?: EuiBreakpointSize[] | 'all' | 'none';

And then be able to pass that exact value to the EuiHide/ShowFor components without needing to do some extra calculation/logic to handle those cases.

It's more of an ease of use for us internally than it might necessarily be for consumers, but it doesn't hurt to provide it at that level instead of hiding behind a service.

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the usage info for show/hide breakpoints - figured it was something like that, wanted to double check. Everything LGTM!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4046/

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_4046/

@cchaos cchaos merged commit b6f793d into elastic:master Sep 22, 2020
@cchaos cchaos deleted the flexing/header_links branch September 22, 2020 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants