Skip to content

[EuiPageTemplate] Add support for fullHeight layouts#4793

Merged
cchaos merged 23 commits intoelastic:masterfrom
cchaos:update/template-full-height
May 25, 2021
Merged

[EuiPageTemplate] Add support for fullHeight layouts#4793
cchaos merged 23 commits intoelastic:masterfrom
cchaos:update/template-full-height

Conversation

@cchaos
Copy link
Copy Markdown
Contributor

@cchaos cchaos commented May 11, 2021

Added fullHeight prop to EuiPageTemplate

Only if template type is 'empty' or 'default'.

Screen Shot 2021-05-11 at 17 50 27 PM

This is essentially to help with layouts like in Kibana's Dev Tools application where the app is the full window height and the inner panels scroll individually. The new prop will extend the height of each child element to height: 100% and cut off overflows. There are three options for this new prop:

  • false: default : Behaves as it does today and relies on the body overflow for scrolling
  • true: Extends the height, but does add scrolling to the EuiPageContentBody component
  • 'noscroll': Extends the height and removes all scrolling ability. Consumers must add it to a child component

There is a slight backup just in case of weird edge cases, like if the height of the browser is too small, a scroll will kick in. This could mean that there's double scroll but at least the content won't get cut off.

Also added minHeight prop directly to EuiPageTemplate to control the forced scrolling in case the window is very short.

Other updates added to help with this

Added .eui-fullHeight and euiFullHeight() utilities

Screen Shot 2021-05-11 at 17 47 29 PM

Added paddingSize to EuiPageSideBar

image

Added flex-shrink: 0 to EuiTabs, EuiSpacer, and EuiImage

If these ever ended up being a direct descendent of a flex container, there was a good possibility they could shrink smaller than their actual height. This is now prevented.

Fixed duplicate main aria roles in the EuiPageTemplate and other common EuiPage patterns

By changing the default component of EuiPageBody from main to div and keeping role=main on EuiPageContent.

Fixed text color of EuiBottomBar

It was using empty color instead of ghost.

image

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 and playground toggles
  • 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

@@ -1,5 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiPageTemplate fullHeight is rendered with noscroll 1`] = `
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does anyone know how to get hooks to work in tests? I can never seem to get useIsWithinBreakpoints() to return true in tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Haven't dug into it, but I think I've faced similar issues with around breakpoints in tests and it's because the window object is all gummed up. You'd need to mock whatever browser APIs you need to get it to work...

'empty',
] as const;

type _EuiPageTemplateTypes = ExclusiveUnion<
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed this exclusive union because it really messes with consuming applications when they try to be wrappers of this component.

@kibanamachine
Copy link
Copy Markdown

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

Removed default `main` as the component for EuiPageBody
@kibanamachine
Copy link
Copy Markdown

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

@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Small docs issue. Don't forget to update the classes on the individual component examples as well. Ran through code and docs. LGTM otherwise.

cchaos added 5 commits May 13, 2021 13:33
Moved this from Sass to `style` tag for easier manipulation
CL
# Conflicts:
#	CHANGELOG.md
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented May 13, 2021

@snide Thanks! Good catch on the sidebar padding. That was a last minute addition that I forgot to check the manual component versions for. Pushed all the changes!

@kibanamachine
Copy link
Copy Markdown

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

@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented May 13, 2021

Jenkins, test this

@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the changes.

@kibanamachine
Copy link
Copy Markdown

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

@kibanamachine
Copy link
Copy Markdown

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

@cchaos cchaos merged commit 5bf86b6 into elastic:master May 25, 2021
@cchaos cchaos deleted the update/template-full-height branch May 25, 2021 14:27
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