Skip to content

[Emotion] Convert the rest of the Loading components#5845

Merged
cchaos merged 19 commits intoelastic:mainfrom
cchaos:css-in-js-convert/loading_content
Apr 28, 2022
Merged

[Emotion] Convert the rest of the Loading components#5845
cchaos merged 19 commits intoelastic:mainfrom
cchaos:css-in-js-convert/loading_content

Conversation

@cchaos
Copy link
Copy Markdown
Contributor

@cchaos cchaos commented Apr 26, 2022

Includes: EuiLoadingContent, EuiLoadingLogo, EuiLoadingElastic, and EuiLoadingSpinner

See further enhancements described in the comments below...

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

@kibanamachine
Copy link
Copy Markdown

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

cchaos added 2 commits April 26, 2022 14:49
…ding_content

# Conflicts:
#	src/components/loading/_index.scss
Comment on lines +11 to +13
export const useLoadingAriaLabel = (): string => {
return useEuiI18n('euiLoadingStrings.ariaLabel', 'Loading');
};
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.

Using one i18n string for all loading aria-labels.

<span className="euiLoadingContent__singleLineBackground" />
</span>
);
lineElements.push(<span key={i} css={lineCssStyles} />);
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 was able to reduce the DOM elements by using pseudo element ::after instead

Comment on lines +54 to +57
// Hide outline mainly for dark mode
&:nth-of-type(1) {
display: none;
}
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.

This is new and fixes dark mode where the white outline wasn't animating nicely with the rest of the nodes.

**Before **
Screen Shot 2022-04-26 at 14 29 12 PM

After
Screen Shot 2022-04-26 at 14 29 18 PM

Comment on lines +53 to +62
s: css`
width: ${euiTheme.size[spinnerSizes.s]};
height: ${euiTheme.size[spinnerSizes.s]};
border-width: 1.5px;
`,
m: css`
width: ${euiTheme.size[spinnerSizes.m]};
height: ${euiTheme.size[spinnerSizes.m]};
border-width: 1.5px;
`,
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.

The one change I did here was increate the border-width from 1px to 1.5px to beef up the appearance. This is something we're incrementally doing with our icons.

It's most noticeable in inputs and buttons:

Before
Screen Shot 2022-04-26 at 14 17 01 PM

After
Screen Shot 2022-04-26 at 14 16 57 PM

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.

Much better! 😍

Comment on lines 20 to 22
// TODO
const sizeToClassNameMap = {
m: 'euiLoadingLogo--medium',
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 was going to do the same thing here as I did in EuiLoadingSpinner, but I need help with TS syntax.

Comment on lines +83 to +91
* 2. Add a half the amount of animation distance padding to the top to give it more room
*/
m: css`
${euiCanAnimate} {
/* 2 */
padding-block-start: calc(
${euiTheme.size[loadingAnimationDistance.m]} / 2
);
}
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 added this no. 2 because the bouncing logos were go way out of their own bounds, so this just adds a bit of separation from it and it's parent.

Before
Screen Shot 2022-04-26 at 14 43 53 PM

After
Screen Shot 2022-04-26 at 14 45 30 PM

@cchaos cchaos marked this pull request as ready for review April 26, 2022 19:37
@kibanamachine
Copy link
Copy Markdown

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

@elizabetdev elizabetdev self-requested a review April 27, 2022 12:08
Copy link
Copy Markdown
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.

It's looking good but I found one issue.

return {
euiLoadingLogo__icon: css`
${euiCanAnimate} {
animation: 1s ${loadingBounce('m')} ${euiTheme.animation.resistance}
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.

This animation is not working. The logos are not bouncing.

Screen.Recording.2022-04-27.at.01.37.54.PM.mp4

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.

Well this is fun... So on page load, the Emotion component styles will load within the global cache layer. But, the way that dev changes are injected, those styles are appended (comes after the CSS styles). @thompsongl , @chandlerprall I can see this happening a lot where we think something is working while we work on it, but on hard refresh it no longer is because the cascade order has changed.

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.

The animation should be fixed now :)

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.

where we think something is working while we work on it, but on hard refresh it no longer is because the cascade order has changed

Hmm I don't have any ideas for this at the moment. It's probably webpack, but I'd need to investigate further.

@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Code LGTM! Just the one change.

Copy link
Copy Markdown
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.

Thanks, @cchaos! Tested again in Chrome, Safari, Firefox, and Edge.

LGTM! 🎉

@kibanamachine
Copy link
Copy Markdown

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

@cchaos cchaos enabled auto-merge (squash) April 27, 2022 18:30
@cchaos
Copy link
Copy Markdown
Contributor Author

cchaos commented Apr 28, 2022

Jenkins, test this

@kibanamachine
Copy link
Copy Markdown

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

@cchaos cchaos merged commit 7eb4fa5 into elastic:main Apr 28, 2022
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