-
Notifications
You must be signed in to change notification settings - Fork 841
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
[CSS-in-JS] Global style reset with emotion
#5122
[CSS-in-JS] Global style reset with emotion
#5122
Conversation
|
||
// Our base fonts | ||
|
||
export const useEuiFont = () => { |
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.
Thinking that we should also provide non-hook versions of these utilities that do not use useEuiTheme
directly, but accept a theme
parameter. This style of hook can then just consume that function and layer on context awareness.
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.
I still think this is a good idea, but I'm going to do a follow-up PR because there are several other hooks that could use the same two-step treatment.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
32512c8
to
468ebd5
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
-webkit-text-size-adjust: 100%; | ||
-ms-text-size-adjust: 100%; |
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.
Can be safely condensed to text-size-adjust
: https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust#browser_compatibility
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Notable omissions from the diff gist:
|
3c5bbf9
to
885b5f1
Compare
Because I removed those 😆 and reduced the font-family stack to a much smaller, necessary stack. |
Oh wow good thing I haven't actually spent any time looking into yet, then 😌 |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Opening this up for review. @cchaos let's decide what to do with the various variables that don't (yet) exist in the JS theme that the global file relies on. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
IssuesI'm just documenting issues as I'm finding them in the diff (I haven't looked at the new reset file yet), not delegating anyone to fix unless you know how to. 1. The compile order is now backwards. It seems the reset is coming in after the component styles.This is clear in the example of input focus rings. 2. Shouldn't be converting colors from hex to RGBThis is apparent in the Diff (but I see different results in the Dev Console locally).
We may want to think on this one a bit then... 3. Stripping out quotes from font-family 👍OutdatedThis is also happening in the Diff but not locally. But certain font families require the quotes to ensure it's finding the right one. I don't think this conversion is going to work as expected.4. Using
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Not entirely sure how to solve this one yet. Now that the global styles are injected after the static css file loads, we may need something like CacheProvider to specify where to inject the globals (i.e., before the static file). Note that this will not be a problem once EUI components are converted; global styles are always injected before non-global styles when done via Emotion. |
Default will mean something different when Amsterdam becomes default so I want to head this off now by checking for “Legacy”
… at the global level
…a provider" This reverts commit 127f12e.
89a3bee
to
b2dcb74
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Looking at this but the |
…in-js/reset # Conflicts: # src-docs/src/views/app_view.js # src/global_styling/index.scss # src/themes/eui-amsterdam/global_styling/index.scss
We don't have to actually keep it converted to TS, i just wanted you to check the provider in a TS file. When I converted I was getting a TS error around the Provider. But as I just tried again, I'm not seeing one. |
Oh I see. No TS errors regarding Providers in that file. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Added docs for EuiProvider, although the location is an afterthought at this point. Will likely refactor after #5227 and after a decision is made on the location of EuiThemeProvider (likely moves from |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5122/ |
The main CI job succeeded but the docs deployment is stuck. Merging without running again. |
* emotion as peerDep; babel and typescript * jest config * isDefaultTheme util * CL TODO * update snapshots * [CSS-in-JS] [Breaking] Deprecating EUI theme to Legacy (#5222) * [CSS-in-JS] Global style reset with `emotion` (#5122) * global reset with emotion * amsterdam overrides * text-size-adjust * ams reset * invert ::selection * Renamed `isDefaultTheme` utility to `isLegacyTheme` Default will mean something different when Amsterdam becomes default so I want to head this off now by checking for “Legacy” * Quick cleanup * Fixed up scrollbar function * Removed `useEuiFont` in favor of a single reset on the elements that need it * Added `body` key to global `font` for setting base body font settings at the global level * Some more fixes based on new diff * global reset with emotion * amsterdam overrides * text-size-adjust * ams reset * invert ::selection * Renamed `isDefaultTheme` utility to `isLegacyTheme` Default will mean something different when Amsterdam becomes default so I want to head this off now by checking for “Legacy” * Quick cleanup * Fixed up scrollbar function * Removed `useEuiFont` in favor of a single reset on the elements that need it * Added `body` key to global `font` for setting base body font settings at the global level * Some more fixes based on new diff * Pulling our reset from global styles * SVG `hacks` directly in reset file * Fixed reset import * euiprovider; reset styles * use euiprovider with emotion/cache in docs * Decision clean up * Fixing a few things for legacy dark mode based on not having a provider * Revert "Fixing a few things for legacy dark mode based on not having a provider" This reverts commit 127f12e. * Actually keeping `colorMode` even if `theme = null` * Fixing merge * Moved reset sass folder to `legacy` * fix wiki * euiprovider docs * fix provider docs * remove commented import Co-authored-by: cchaos <caroline.horn@elastic.co> * [CSS-in-JS] Add provider to generated codesandbox examples (#5253) * add provider to generated codesandbox examples * indentation * euithemeprovider -> euiprovider * legacy theme * fix snapshot tests * [CSS-in-JS] Provider for fullscreen examples; Context refactor (#5309) * refactor to extract context component * refactor for fewer updates on route changes * refactor AppView to function component * [CSS-in-JS] [Breaking] Better Getting Started page (#5299) * Moved all color Sass files to their respective theme folders - Duplicates variables, but makes it actually capable of customization - New files for code & vis colors that weren’t theme specific * Remove outdated theming wiki page * Cleanup (in MD files too) * fix heading level * update changelog page regex to fully remove the master section * manual merge * update release script changelog regex * Cleanup some docs * Hide LanguageSelector tour on Getting Started page * Some GS page cleanup * PR feedback * cl * Apply suggestions from code review Co-authored-by: Constance <constancecchen@users.noreply.github.com> * lint fix * make amsterdam default * provider updates * fix cypress styles * PR feedback: - Removed blank mixins file - Added `yarn add` block for dependencies - Added props table to bottom of Provider docs page * move keydown inside useeffect * Reusing correct Sass customization snippet under Customizing * fix cypress path * update export Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com> Co-authored-by: cchaos <caroline.horn@elastic.co> Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Summary
Replacing the Sass global reset file with a 1:1 conversion using
Global
from@emtion/react
Enabled in the docs; try to find any differences as compared to the production site 🕵️
Diff of the CSS vs.
emotion
output can be seen in this gist. Note that there are prefixing differences becauseemotion
usesstylis
for preprocessing.This PR also changes the
isDefaultTheme
utility toisLegacyTheme
.Checklist
- [ ] Checked in mobile- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Added or updated jest tests- [ ] A changelog entry exists and is marked appropriately