[Into Feature] New EuiPageTemplate as namespaced component for versatile stacking#5905
Conversation
Setup pattern for demo toggles
…tes/page_docs_toggles # Conflicts: # scripts/a11y-testing.js # src-docs/src/views/page/page_template_example.js # src-docs/src/views/panel/panel_example.js
…eature_page_templates/page_docs_toggles # Conflicts: # scripts/a11y-testing.js # src-docs/src/views/page/page_template_example.js # src-docs/src/views/panel/panel_example.js
- Removed nested page header styles when within EuiPageBody (improved way of doing this coming later)
…ough to examples
Still could use some cleanup
…page_now/page_docs_toggles
…ugh custom controls Update EuiPage’s example usage to use GuideSection directly
# Conflicts: # src-docs/src/views/page/page_example.js
and added EuiPageSidebar description to first example
…ge/template_demo_toggles
…ge/template_demo_toggles
# Conflicts: # src-docs/src/views/page/page_simple.tsx # src-docs/src/views/page/page_template.tsx
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>
Doing so made it impossible to change things like centering contents. The guidance now is to always use a page component.
|
Update: I've update the template to no longer auto-wrap non-namespaced children with a section element. I found this was causing trouble being able to create full-height layouts / custom layouts if you don't have access to the top template. Example was when I updated the 404 page. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
The multiple `main` elements cause errors, but we don’t want consumers to change these so we don’t want to change the copy/paste code.
…ge/template_demo_toggles
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
elizabetdev
left a comment
There was a problem hiding this comment.
Thanks, @cchaos for making the suggested changes.
I tested locally in Chrome, Safari, Edge, and Firefox LGMT! 🎉
|
Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
|
Thank you both!! |
|
I forgot about a changelog, so I'll add that real quick (even though its a feature branch) then merge |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5905/ |
Warning: DO NOT LOOK AT THE COMMIT HISTORY 🙈
New template components
EuiPageTemplateThis new version of the component is a namespaced component that clones the direct children, checking for if they're specifically one of the namespaced components and then clones and applies specific 'global' styling attributes to them based on top-level props and the full configuration of other existing components. If a child is not a namespaced component, it will get wrapped in a page section.
The template specific versions of these child components are prefixed with
_because they should not be used as standalone components. They should always be used via their namespaced component similar to how EuiSplitPanel is handled.For full details, read through the new documentation page: https://eui.elastic.co/pr_5905/#/templates/page-template
_EuiPageOuteras the overall wrapping componentThe props are similar to that of
EuiPagebut withoutrestrictWidth. It does add aresponsiveprop for customizing the breakpoints at which to shift to mobile view._EuiPageInneras the overall wrapping component for the main contents (not including sidebar)The props are similar to
EuiPageBodybut withoutrestrictWidthandpanelPropsas it doesn't extend EuiPanel. It does add aborderprop which is mainly controlled by the template to add a single left-side border if a pagesidebar exists to provide definition of space._EuiPageSidebaras EuiPageTemplate.SidebarThis component is similar to the existing EuiPageSideBar in that it doesn't do much but handle some padding and sticky position behavior. However, this version is more customizable, relying less on Sass vars/mixins to allow customizing:
sticky.offset: Manual customization of thetopoffset for sticky sidebars, otherwise ifsticky=trueit will calculate it's top position based on the newdata-fixed-headersquantity applied to thebodyelement.minWidth: Passed to thestyletag, defaults to260pxresponsive: Allows customizing the array of breakpoint names in which to show the mobile versionEuiPageHeaderas EuiPageTemplate.HeaderExtends the existing EuiPageHeader passing through props like
paddingSizeandrestrictWidthto match those of top-level props.EuiPageSectionas EuiPageTemplate.SectionExtends the existing EuiPageSection passing through props like
paddingSizeandrestrictWidthto match those of top-level props. I also took the opportunity to fix the output of the class list of EuiPageSection._EuiPageEmptyPromptas EuiPageTemplate.EmptyPromptThis component basically just wraps an EuiEmptyPrompt with a EuiPageSection, extending the props of both. It does allow easily providing the
bodycontent as thechildren. The main piece here is that it will always center the prompt in the section and handles the configuration of how to display the page section vs empty prompt based on thepanelledandcolorvalues.eui/src/components/page_template/empty_prompt/page_empty_prompt.tsx
Lines 31 to 35 in ccfc902
_EuiPageBottomBaras EuiPageTemplate.BottomBarThis component extends EuiBottomBar, but wraps the children in an EuiPageSection to allow restricting the width similar to the rest of the page contents and allowing the same
paddingSizevalues.Deprecations
EuiPageTemplatehas been deprecated and renamed toEuiPageTemplateProps_Deprecatedto reflect that. To continue using the deprecated version, consumers will need to change their import to:Other fixes/additions
logicalStyle()to return the same value type as was passed in (instead of converting to string)AddedlogicalUnitforvhandvwDocumentation
All of the old template docs have been deleted and re-written for the new component. They've also moved to their own docs folder
page_template/. They no longer showcase a "custom" build vs "template" build because the template is fully customizable. The page components examples have been simplified in their organization.I've updated any usage of the deprecated version in other docs files to use the new template version.
Todo
✅ A11y: Page section roles
Right now the struggle is not being able to contain a
role="header"inside of arole="main"element, otherwise I could blanket change the inner components (the wrapper of all page contents) in a<main>element. But sinceEuiPageHeaderrenders as a<header>element, this breaks the nesting rule.Checklist
[ ] Checked Code Sandbox works for any docs examples[ ] Checked for breaking changes and labeled appropriately