-
Notifications
You must be signed in to change notification settings - Fork 842
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
[Into Feature] New EuiPageTemplate as namespaced component for versatile stacking #5905
[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 <[email protected]>
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/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM!
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
EuiPageTemplate
This 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
_EuiPageOuter
as the overall wrapping componentThe props are similar to that of
EuiPage
but withoutrestrictWidth
. It does add aresponsive
prop for customizing the breakpoints at which to shift to mobile view._EuiPageInner
as the overall wrapping component for the main contents (not including sidebar)The props are similar to
EuiPageBody
but withoutrestrictWidth
andpanelProps
as it doesn't extend EuiPanel. It does add aborder
prop which is mainly controlled by the template to add a single left-side border if a pagesidebar exists to provide definition of space._EuiPageSidebar
as 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 thetop
offset for sticky sidebars, otherwise ifsticky=true
it will calculate it's top position based on the newdata-fixed-headers
quantity applied to thebody
element.minWidth
: Passed to thestyle
tag, defaults to260px
responsive
: Allows customizing the array of breakpoint names in which to show the mobile versionEuiPageHeader
as EuiPageTemplate.HeaderExtends the existing EuiPageHeader passing through props like
paddingSize
andrestrictWidth
to match those of top-level props.EuiPageSection
as EuiPageTemplate.SectionExtends the existing EuiPageSection passing through props like
paddingSize
andrestrictWidth
to match those of top-level props. I also took the opportunity to fix the output of the class list of EuiPageSection._EuiPageEmptyPrompt
as EuiPageTemplate.EmptyPromptThis component basically just wraps an EuiEmptyPrompt with a EuiPageSection, extending the props of both. It does allow easily providing the
body
content 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 thepanelled
andcolor
values.eui/src/components/page_template/empty_prompt/page_empty_prompt.tsx
Lines 31 to 35 in ccfc902
_EuiPageBottomBar
as 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
paddingSize
values.Deprecations
EuiPageTemplate
has been deprecated and renamed toEuiPageTemplateProps_Deprecated
to 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)AddedlogicalUnit
forvh
andvw
Documentation
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 sinceEuiPageHeader
renders 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