Skip to content
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

[Final Feature PR] Convert to remaining page components to Emotion #5948

Merged
merged 11 commits into from
Jun 13, 2022

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Jun 2, 2022

🙌 This is the final feature PR that just converts the remaining components to Emotion or deprecates some old ones without converting.

Converted:

  • EuiPage
  • EuiPageBody

Deprecated and not converted:

  • EuiPageContent -> EuiPageContent_Deprecated
    • Including all sub-components now named:
      • EuiPageContentBody_Deprecated
      • EuiPageContentHeader_Deprecated
      • EuiPageContentHeaderSection_Deprecated
  • EuiPageSideBar -> EuiPageSideBar_Deprecated (use new EuiPageSidebar instead)

Moved:

  • Moved page_template/sidebar to page/page_sidebar to replace the deprecated version
    • Renamed _EuiPageSidebar -> EuiPageSidebar
    • Renamed _EuiPageSidebarProps -> EuiPageSidebarProps

Checklist

  • Checked 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 any docs examples
  • Added or updated jest and cypress tests
  • [ ] Checked for breaking changes and labeled appropriately
  • [ ] Checked for accessibility including keyboard-only and screenreader modes
  • [ ] Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

cchaos added 6 commits May 17, 2022 19:11
# Conflicts:
#	src/components/page/page_body/__snapshots__/page_body.test.tsx.snap
#	src/components/page/page_body/page_body.tsx
and move new EuiPageSidebar to /page and export
@kibanamachine
Copy link

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

@cchaos cchaos marked this pull request as ready for review June 6, 2022 20:39
@cchaos
Copy link
Contributor Author

cchaos commented Jun 6, 2022

This PR is ready for review, just doing the final checks

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@elizabetdev elizabetdev self-requested a review June 7, 2022 12:26
@kibanamachine
Copy link

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

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

Looking forward to having the feature PR merged! 😍

I just found some minor issues, but nothing special.

src/components/page/page.tsx Outdated Show resolved Hide resolved
src/components/page/_restrict_width.styles.ts Outdated Show resolved Hide resolved
@@ -176,7 +180,7 @@ export const _EuiPageTemplate: FunctionComponent<EuiPageTemplateProps> = ({
}
});

const _minHeight = grow ? `max(${minHeight}, 100vh` : minHeight;
const _minHeight = grow ? `max(${minHeight}, 100vh)` : minHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

The minHeight prop is defined as string, should it be instead CSSProperties['minHeight']? I think this would make this prop more consistent with other components similar props.

Screenshot 2022-06-08 at 12 55 20

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that the CSSProperties version actually evaluates to MinHeight<string | number> and I can't accept a number since it isn't applied directly to the style attribute but interpolated into a string first. (Well, I guess I could accept it, but I'd have to add a lot other logic to append px if it is a number.) It just seemed most straight forward to restrict it to string only.

margin-left: auto;
margin-right: auto;
width: ${width};
max-width: ${PAGE_MAX_WIDTH};
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this max-width use a logicalCSS()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch with all those. I forgot to go back and check. I'll update.

@@ -176,7 +180,7 @@ export const _EuiPageTemplate: FunctionComponent<EuiPageTemplateProps> = ({
}
});

const _minHeight = grow ? `max(${minHeight}, 100vh` : minHeight;
const _minHeight = grow ? `max(${minHeight}, 100vh)` : minHeight;

const classes = classNames('euiPageTemplate', className);
const pageStyle = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this pageStyle be converted to Emotion? So that the styles don't show in the style prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left it as a style property because it's values are affected by other things on the page and I worried about the effect it would have on Emotion styling changing and not updating quickly enough. Also it could mean that it changes the class on every render which isn't very effecient.

@kibanamachine
Copy link

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

@cchaos
Copy link
Contributor Author

cchaos commented Jun 13, 2022

I'm going to merge this into the feature branch on green. Unfortunately, it's not actually the last PR.. 😢 I have to re-work the cloning method of EuiPageTemplate to better suit Kibana's implementation. So keep an eye out for a new one. 😬

@cchaos cchaos merged commit 2c21eb5 into elastic:feature/page_templates Jun 13, 2022
@cchaos cchaos deleted the _page/convert_to_emotion branch June 13, 2022 16:56
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.

3 participants