[EuiPageLayout] Add bottomBar & [EuiBottomBar] Add more position props#4662
[EuiPageLayout] Add bottomBar & [EuiBottomBar] Add more position props#4662chandlerprall merged 31 commits intoelastic:masterfrom
bottomBar & [EuiBottomBar] Add more position props#4662Conversation
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
| // TODO: Allow this hooke to be conditional | ||
| const dimensions = useResizeObserver(resizeRef); |
There was a problem hiding this comment.
It doesn't necessarily have to happen in this PR, but we should allow this hook to be conditional somehow. In this particular instance, we don't need to watch for resizing unless the user has specified to affordForDisplacement.
bottomBar & [EuiBottomBar] Add more position props
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
…n_page # Conflicts: # CHANGELOG.md # src-docs/src/views/bottom_bar/bottom_bar_example.js # src-docs/src/views/bottom_bar/playground.js
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Handful of small asks + one question; substance of changes looks great!
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
|
PR for you, moving the role=main logic into EuiPageContent: cchaos#47 |
Moved role=main logic into EuiPageComponent
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
|
I need help, because I'm really struggling to understand why this PR would mess up the EuiHeaderSectionItemButton's |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
|
Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
…n_page # Conflicts: # src-docs/src/views/page/page_example.js
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Changes LGTM, pulled locally to test the template prop interaction with bottomBar/bottomBarProps
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4662/ |
This has been a big struggle for some consumers especially when there is side-nav. So this PR builds an optional
bottomBarinto the page template, while also adding some more props to EuiBottomBar for customizing position.EuiBottomBar
There had been talk of deprecating the EuiBottomBar for the EuiControlBar, but the lack of custom content in EuiControlBar hasn't allowed us to do that. So now I'm more beefing up the bottom bar that may eventually replace the wrapping component of EuiControlBar which would just be content-specific.
I've also rewritten the component to use
useEffectinstead of the old way anduseResizeObserver()as the size watcher.New props
position: 'static' | 'sticky' | 'fixed'- Defaults tofixedusePortal: boolean- Only works ifpositionisfixed; Defaults totrue🔔 BREAKING: Moved all the positioning attributes to be applied as
styleattributes.Any custom classes or CSS used to position the bar, will need to adjust these by add
!importantfor overrides or use the following new props (their defaults shown):left= 0right= 0bottom= 0topI also darkened the bottom bar color to better match the header.
EuiPageTemplate
I found that the easiest way to accomodate side-navs when using the bottom bar, is to place it as the last item inside EuiPageBody with
position = sticky. This way it will never overlap the side bar on the left (as it's contained within the page body) and in mobile it will never overlap the revealed navigation list as it will stop being "sticky" when page body is not in view.Screen.Recording.2021-03-24.at.10.11.26.AM.mp4
So this PR adds the following bottom bar props, but it's only allowed when
template = 'default'because empty pages should not have bottom bars when there's nothing to "save".bottomBar: ReactNode- Any contentsbottomBarProps: EuiBottomBarProps- Extends the components propsThe
bottomBarcontents also gets wrapped in a EuiPageContentBody so that it can accept the samerestrictWidthprop for keeping content aligned.Other updates
role="main"to the EuiPageContent elements in the template and code examples for accessibility.bottomBorderprop to EuiPageHeader, this allows me to enforce the bottom border when I couldn't target it successfully with CSSChecklist