Repository navigation
[Page layouts] Updates to [EuiSideNav] - #4488
Conversation
Including `innerText` for `titles` when truncation is on
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
| // Redoing this mixin mainly to remove the letter-spacing | ||
| @mixin euiFont { |
There was a problem hiding this comment.
I just noticed this when I'd toggle between clickable and not-clickable, the letter-spacing would change because there was still a missing Amsterdam override to remove it from this mixin.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
Clarifying: the two sets of props should be the same, or they are intentionally different and you're simply explaining the complication? |
|
The two sets of props are currently intentionally different. Being that EuiSideNavItem is technically an internal-only component right now since the larger EuiSideNav component handles all the logic like nesting. Could they be more uniform? Probably. Is it necessary? Not sure. But it makes it hard to do any testing at the EuiSideNavItem level in the docs themselves. |
|
Got it. I think the refactor you made is a good step, and I don't see a lot of additional available gain from a TS point of view. |
|
jenkins test this
|
thompsongl
left a comment
There was a problem hiding this comment.
Code changes LGTM
Just a couple small things
| children: ReactNode; | ||
| } | ||
| export type RenderItem<T> = ( | ||
| // argument is the set of extra component props + GuaranteedRenderItemProps |
There was a problem hiding this comment.
| // argument is the set of extra component props + GuaranteedRenderItemProps | |
| // argument is the set of extra component props + SideNavItemButtonProps |
| export { EuiSideNav } from './side_nav'; | ||
| export { EuiSideNavItem } from './side_nav_item'; |
There was a problem hiding this comment.
Export prop types, also?
There was a problem hiding this comment.
That's where it all gets confusing because on the next line, the actual item props get exported from a specific types file. But we don't export EuiSideNavItem any higher than this (and I think I could actually remove this since it was originally added when I attempted to add a playground). So I'm just going to remove this export but I did add the props for the EuiSideNav
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4488/ |
elizabetdev
left a comment
There was a problem hiding this comment.
I tested again in Chrome, Edge, Firefox, Safari, and I also looked at the code.
LGTM! 🎉
[Page layouts] Updates to [EuiSideNav] (elastic#4488)

This PR is mostly backlog fixes and a couple prop additions
1. Fixed nested indicator when item is the last one
The left side indicator used to extend too far down. Now it will stop at the last child.
2. Re-arranging text color styles for easier className overrides
Fixes #2380
When passing a custom
classNameto the nav item to change the text color, where the class was applied and where the styles were applied would not allow this. Now the CSS applies thecolorat theEuiSideNavItemlevel so that the button inherits.So doing something like this
Results in:
3. Added a
truncateprop that can be applied to the whole EuiSideNav or an individual itemFixes #4264
It is on by default and includes
innerTextfortitleswhen truncation is on.4. Added
disabledstate to items and fixed up some other interaction state stylesBefore, if you tried to add
disabledto a particular nav item, it would not get respected. It was not passed down to the actual button and so never actually disabled anything.Now, it's passed down to the right component and has styles applied.
5. Added an
emphasizeprop to side nav items that adds a background and bolds the buttonThis enhancement came mainly from Cloud but is also a possible enhancement for any side nav items that are rendered "dynamically" or for any other reason that a consumer might want to emphasize a certain section.
6. Consolidating some prop types
The prop types for this component are a bit screwy. See #4487. But also, the allowed props on individual items passed as an object to EuiSideNav are not the same as ones for EuiSideNavItem. It gets all very complicated, but I tried to reduce some of the duplication by extending each other. I still think it could be further cleaned up but I'm not enough familiar with the generic types. This is also why no playground was added.
Checklist
and playground toggles[ ] Checked for breaking changes and labeled appropriately