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

[FEATURE] CSS-in-JS via emotion, initial release #4511

Merged
merged 74 commits into from
Aug 26, 2021
Merged

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Feb 10, 2021

This is the initial release of Emotion (docs only; devDependencies) and the new EuiThemeProvider.

Components

  • EuiThemeProvider: React context provider for theme values and color mode selection
  • useEuiTheme: theme consumer in React hook form
  • withEuiTheme: theme consumer in React HOC form (for class components)

The themes (#4643)

  • Decide on naming. Do we keep the same prefixes like theme.colors.euiPrimary or simplify to theme.colors.primary? (Survey results)
  • Colors (for each)
  • Sizing
  • Borders
  • Breakpoints
  • Animation
  • Typography

Docs


Checklist

  • Check against all themes for compatibility in both light and dark modes

- [ ] Checked in mobile

- [ ] 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

@cchaos cchaos changed the title [FEATURE] Emotion ... aka CSS in JS [FEATURE] Emotion ... aka CSS in JS initial release Feb 10, 2021
@cchaos cchaos added the meta label Feb 10, 2021
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

* poc

* tidy

* proxy set handler

* default theme; docs setup

* table colors via css-in-js

* exports

* withEuiTheme; useEuiTheme return shape; some types

* export and proxy fixes

* use without provider; some test setup

* prevent unnecessary updates

* refactor colorMode calc; move computation to provider

* utils refactor

* clean up

* compute default theme for initial context value

* snapshot update preview

* axe ignore temporary docs page

* theme: colorVis and borders, sizes update

* coupled types

* some utils tests

* start to amsterdam; name in theme obj

* Revert "table colors via css-in-js"

This reverts commit 5614b0f.

* eslintrc

* readme

Co-authored-by: cchaos <caroline.horn@elastic.co>
@kibanamachine
Copy link

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

thompsongl and others added 3 commits March 1, 2021 11:03
* allow custom properties via overrides; type clean up

* add some tests

* update canopy

* overrides -> modify

* clean up

* Update src/services/theme/README.md

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* update readme

* Update src/components/common.ts

Co-authored-by: Chandler Prall <chandler.prall@gmail.com>

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

thompsongl and others added 2 commits March 11, 2021 10:31
* convert useEuiTheme to return object; refactor withEuiTheme types

* readme update

* update docs

* Quick update to the docs

Co-authored-by: cchaos <caroline.horn@elastic.co>
@kibanamachine
Copy link

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

* convert numbers to strings with units

* docs

* fewer calc()

* Updating consuming example to show `calc()`

Co-authored-by: cchaos <caroline.horn@elastic.co>
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

scripts/a11y-testing.js Outdated Show resolved Hide resolved
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

😲 this LGreatTM; cannot observe additional page load weight in Kibana, value updates take 2-4 frames (24-40ms) to compute an updated theme, trigger the React context updates, and re-paint in Emotion. Further perf testing would need to be done outside Kibana, but this is absolutely fine to go 🎉

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

I contributed a lot of the code here, so I'm signing off from the perspective that I plan on making no further changes and am very pleased with how the theme shape came together.

Thanks for all the work, @cchaos! Can't wait to keep moving with this approach 🥳

@cee-chen
Copy link
Member

Sorry, I just realized I'm not sure if my approval is blocking merge - I'll be honest that 6k is a lot of lines to review and I mostly did a skim of the docs 🙈 From everything that I've heard from Greg's high-level walkthrough and the syncs, the underlying work sounds solid+super impressive to me! API and usage looks good as well - I'm sure we'll find either pain points or improvement areas as we start the process of converting our components over, and can continue to improve as we go.

TL;DR 🚀 🚀 🚀

@cchaos cchaos enabled auto-merge (squash) August 26, 2021 18:22
@kibanamachine
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.