-
Notifications
You must be signed in to change notification settings - Fork 121
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
fix(css): remove dependency on EUI components and use only EUI styles #208
Conversation
Codecov Report
@@ Coverage Diff @@
## master #208 +/- ##
==========================================
+ Coverage 97.82% 97.82% +<.01%
==========================================
Files 35 36 +1
Lines 2569 2571 +2
Branches 565 578 +13
==========================================
+ Hits 2513 2515 +2
Misses 49 49
Partials 7 7
Continue to review full report at Codecov.
|
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.
just a few small comments but otherwise lgtm. tested locally and looking good!
I am struggling to test this in Kibana. I have built it with like so: darkMode ?
[
`${basePath}/node_modules/@elastic/eui/dist/eui_theme_dark.css`,
`${basePath}/node_modules/@kbn/ui-framework/dist/kui_dark.css`,
`${basePath}/node_modules/@elastic/charts/dist/theme_dark.css`,
] : [
`${basePath}/node_modules/@elastic/eui/dist/eui_theme_light.css`,
`${basePath}/node_modules/@kbn/ui-framework/dist/kui_light.css`,
`${basePath}/node_modules/@elastic/charts/dist/theme_light.css`,
] I get 404 errors and it completely borks Kibana, getting the "Kibana didn't load properly" error. I can import the @import '@elastic/charts/src/theme_light'; But of course, that duplicates these styles numerous times and I'm pretty sure it doesn't swap light for dark. Any thoughts on how to appropriately handle the themes and importing? |
@cchaos I think you have to add the following:
at line 59 of I've just tried and it works |
|
||
// Families | ||
|
||
$echFontFamily: 'Inter UI', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, |
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.
We shouldn't be importing 'Inter UI' in this base library. We should probably just stick to system fonts. In fact, I think there's a lot of unnecessary invisibles brought in here from EUI.
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.
@cchaos what are the system fonts i can use? -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif
?
I also need the right one to use on the canvas text elements, what I can use there?
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.
Removing the Inter UI
bit is all you need. The ones that follow are "system fonts". Apple, then MS, then Linux, then Helvetica.
Hey @cchaos are you still working on that? Should we start to wrap up and merge this PR? |
@markov00 Yes, I'm actively working on this. I think I'm just about done, but have I'm double-checking it in EUI right now and will need to do so in Kibana as well. |
@markov00 PR4U: markov00#2 |
hey @cchaos I've merged your PR and rebased everything. |
@cchaos @snide I've also minor concern on the readability of the highlighted value on the tooltip. This is the current implementation: From my point of view, adding changing the font-weight with a higher value create few disadvantages:
|
@markov00 I actually agree. I wanted to come back and revisit that but had forgotten. I will work on those states. |
@@ -91,7 +90,6 @@ | |||
"husky": "^1.3.1", | |||
"jest": "^24.1.0", | |||
"jest-environment-jsdom-fourteen": "^0.1.0", | |||
"moment": "^2.24.0", |
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.
So moment
was a dependency of @elastic/[email protected]
but not @elastic/eui@^11.2.1
?
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.
EUI is only being consumed for it's SASS variables so there's no need fo this peer dependency.
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.
@cchaos cool thanks!
@@ -119,7 +117,6 @@ | |||
"d3-shape": "^1.3.4", | |||
"fp-ts": "^1.14.2", | |||
"konva": "^2.6.0", | |||
"lodash": "^4.17.11", |
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.
Nice!! 🎉
The problem with that is that it will override any base styles declared outside of the .echContainer. ExampleReset file includes: a { color: blue } Consumer's theme is: a { color: red } But then including the charts styles with the reset would make it: .echContainer a { color: blue } completely overriding the consumer's theme. |
@cchaos OK. Looks good. Thanks for updating the docs too. |
@cchaos I've added the legend toggle button, Do you want to take a look if everything seems fine? I've also played a bit with the dark mode, and seems that in darkmode the tooltip is fully black. if we have a full black |
This is how the tooltip works in EUI. Not backgrounds should actually be fully black. Our default "white" background actually goes to a "dark gray" in dark mode: I had also changed that fully black background to our default background color here: https://github.com/elastic/elastic-charts/pull/208/files#diff-6cc5987d83a2bd4599131f08c70199cf You can see there is a slight variation in color. But that's how we work with them currently in EUI and would like to stick with the same method here. |
Pushed more fixes to legend toggle. |
@cchaos I'm ok with the changes. If you think we are done, I will fix the squash commit and merge it |
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'm happy with it. We'll want to setup a PR to update it in Kibana correctly with the new styles imports.
@cchaos I can do that if you want, let me fix conflict, merge and I will create the PR in Kibana |
Introduced new chart scss code to replace the existing EUI sass styles.
All class and mixins are now under .ech prefix
This commit change the current output style to two different styles, one for dark and one for light theme. BREAKING CHANGE: EUI is removed from this library. The single chart `style.css` stylesheet is now replaced by a `theme_light.css` or `theme_dark.css` file that brings in all the required styling for chart, tooltip and legends.
Reverting the EUI removal
the time-scale-utils file was to test some assumptions but it's currently not required. The same for the color functions
# [5.0.0](v4.2.9...v5.0.0) (2019-06-10) ### Bug Fixes * **css:** remove dependency on EUI components and use only EUI styles ([#208](#208)) ([122fade](122fade)) ### BREAKING CHANGES * **css:** EUI components are removed from this library. The single chart `style.css` stylesheet is now replaced by a `theme_only_light.css` or `theme_only_dark.css` file that brings in all the required styling for chart, tooltip and legends. `theme_light.css` and `theme_dark.css` styles include also a reset CSS style
🎉 This PR is included in version 5.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [5.0.0](elastic/elastic-charts@v4.2.9...v5.0.0) (2019-06-10) ### Bug Fixes * **css:** remove dependency on EUI components and use only EUI styles ([opensearch-project#208](elastic/elastic-charts#208)) ([a26d2db](elastic/elastic-charts@a26d2db)) ### BREAKING CHANGES * **css:** EUI components are removed from this library. The single chart `style.css` stylesheet is now replaced by a `theme_only_light.css` or `theme_only_dark.css` file that brings in all the required styling for chart, tooltip and legends. `theme_light.css` and `theme_dark.css` styles include also a reset CSS style
Summary
This PR update the EUI dependency and clean its use inside the library. The following thing are changed:
ech
instead of the longelasticCharts
eye
open and closed on the legend is different from the EUI one: there is no animation on that button, but only a static change.Before
After
Before
After
Before
After
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.src/index.ts
(and stories only import from../src
except for test data & storybook)