Skip to content

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

Merged
cchaos merged 74 commits into
masterfrom
feature/css-in-js
Aug 26, 2021
Merged

cchaos merged 74 commits into
masterfrom
feature/css-in-js

Conversation

@cchaos

@cchaos cchaos commented Feb 10, 2021 •

Copy link
Copy Markdown
Contributor

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 Used to group similar requests or tracking. Not an Epic. label Feb 10, 2021
@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

* 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 <[email protected]>
@kibanamachine

Copy link
Copy Markdown
Contributor

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

* update readme

* Update src/components/common.ts

Co-authored-by: Chandler Prall <[email protected]>

Co-authored-by: Caroline Horn <[email protected]>
Co-authored-by: Chandler Prall <[email protected]>
@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@thompsongl thompsongl mentioned this pull request Mar 4, 2021
4 of 10 tasks
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 <[email protected]>
@kibanamachine

Copy link
Copy Markdown
Contributor

* convert numbers to strings with units

* docs

* fewer calc()

* Updating consuming example to show `calc()`

Co-authored-by: cchaos <[email protected]>
@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

Comment thread scripts/a11y-testing.js Resolved
@kibanamachine

Copy link
Copy Markdown
Contributor

@kibanamachine

Copy link
Copy Markdown
Contributor

@chandlerprall chandlerprall left a comment

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 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 🎉

@thompsongl thompsongl left a comment

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.

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Used to group similar requests or tracking. Not an Epic.

Projects

None yet

Development

Successfully merging this pull request may close these issues.