-
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
refactor(wordcloud): cleanup config, types and theming (#1358) #1407
Conversation
BREAKING CHANGES: The `WorkcloudSpec.config` prop is removed as it was not used other than assigning `margins` even with erroneous properties. All wordcloud properties are now driven from the `WorkcloudSpec` directly. Since the wordcloud is unique in that it's styles are driven by the data I think keeping them on the spec is more favorable than moving them to the theme as they would be overridden more frequently. This does not provide a themed instance of the chart type but this could possibly come from `.brightening` the provided colors of the text elements. Changes include - `WorkcloudSpec.margin` deleted in favor of `Theme.chartMargins`. - `WorkcloudConfigs` is removed in favor of singular `WordcloudViewModel` type which is extended to form `WordcloudSpec`.
storybook/style.scss
Outdated
@@ -1,4 +1,5 @@ | |||
@import '~@elastic/eui/dist/eui_theme_light'; | |||
@import '~@elastic/charts/src/theme_light'; |
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.
This is recommended by EUI team to fix base styles. Causing changes to integration/tests/__image_snapshots__/interactions-test-ts-interactions-tooltips-should-render-current-tooltip-in-dark-theme-1-snap.png
.
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.
In the screenshot, it looks like it's using the light theme tooltip color instead of the dark one.
There is also another difference: this is not the same result as it appear on storybook (in storybook the tooltip bg color is black, not dark gray)
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.
@nickofthyme before merging please check my comment above
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.
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.
LGTM, read through the code and still like the code noise removals ✂️
const getTemplate = (name: string): WordcloudKnobs => { | ||
switch (name) { | ||
case 'single': |
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.
What is the benefit of changing this to a function?
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.
easier typing but yeah doesn't really make much difference.
storybook/style.scss
Outdated
@@ -1,4 +1,5 @@ | |||
@import '~@elastic/eui/dist/eui_theme_light'; | |||
@import '~@elastic/charts/src/theme_light'; |
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.
In the screenshot, it looks like it's using the light theme tooltip color instead of the dark one.
There is also another difference: this is not the same result as it appear on storybook (in storybook the tooltip bg color is black, not dark gray)
@elasticmachine merge upstream |
Summary
Refactor
wordcloud
spec to cleanup duplicate or unused config and types.BREAKING CHANGES
The
WorkcloudSpec.config
prop is removed as it was not used other than assigningmargins
even with erroneous properties. All wordcloud properties are now driven from theWorkcloudSpec
directly. Since the wordcloud is unique in that it's styles are driven by the data I think keeping them on the spec is more favorable than moving them to the theme as they would be overridden more frequently. This does not provide a themed instance of the chart type but this could possibly come from.brightening
the provided colors of the text elements.Changes include
WorkcloudSpec.margin
deleted in favor ofTheme.chartMargins
.WorkcloudConfigs
is removed in favor of singularWordcloudViewModel
type which is extended to formWordcloudSpec
.Details
Applies #1358 to
master
Other Changes:
Word
types are refined to reflect the mutating nature ofd3TagCloud
function.d3-cloud
Checklist
:xy
,:partition
):interactions
,:axis
):theme
label has been added and the@elastic/eui-design
team has been pinged when there areTheme
API changescloses #123
,fixes #123
)packages/charts/src/index.ts
dark
,light
,eui-dark
&eui-light