-
Notifications
You must be signed in to change notification settings - Fork 842
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
Move shared component mixins to global_styles #2551
Move shared component mixins to global_styles #2551
Conversation
A quick note: once I got into the |
@cchaos @ryankeairns (and others) — As previously discussed, I've finished up pulling out any shared mixins from the components and put them into the Screencast: https://www.loom.com/share/8095521ed8e940fea659ae35442aa5ed Questions
|
@johnbarrierwilson I appreciate you digging into and grokking the world view of the My initial reaction, regardless of whether we tackle this re-organization or not, is that it feels wise to merge this PR with its current smaller scope - keeping it small and digestible while allowing you to keep momentum on the visual design effort. Personally, I like the convenience of having the SCSS files right there with the component from a development perspective as it's very easy to find files/styles. This proposed change also has me wondering about potential impacts this might have to our current build/release process (maybe it's minimal?) and what (if any) affect this could have on our future plans with regards to modularization/use of astroturf, etc. In other words, would moving these files have any impact down the road? Tagging in Chandler and Greg for more perspective on those fronts. |
@ryankeairns Glad the map is helpful! 😊
I totally agree and will do some more testing to make sure everything is stable, then I'll open it for review.
I think those are also valid concerns. The largest issue I was attempting to address here is the ease of theme-ability by trying to avoid this as illustrated in my previous PR: From personal experience, I've used a |
@johnbarrierwilson I agree with @ryankeairns about having the component SASS files next to the component JS files. We did this very intentionally so that we knew exactly where to look for styles and we've matched our SASS file namings based on the JS files. We also carry this pattern to Kibana as that file structure is way less straight forward and plugins having their own compile file. It does cause some weirdness with globals and shared styles/mixins. However, the tradeoff is not having to scour the files or searching in project for classes to find the right files. In all my previous projects I have worked the way you mentioned (styles in one folder, js in another) and I'm a complete convert to this pattern as a maintainer of such a large system and working within and gigantic file system like Kibana. We are definitely happy to help you reorganize certain mixins to globals, but we will need to keep the general structure as it is. |
👍🏻10-4! Thanks for shedding a bit more light on the thoughts. I'll move forward with this PR as-is! |
Whoa, I really appreciate all your thought and explanation here. The gist is, I agree that component-specific stylesheets should remain inside the same directory as the JS/TS component files, and we should reorganize some shared/global things. Potential impacts to the current build system aren't concerning (even in the proposed reorg), but impacts to an eventual move to CSS Modules or CSS-in-JS would be fairly substantial. The main reason being that with either new approach, there will be actual interop between style files and component files (i.e., the component file will directly import the style file instead of a global manifest). The argument for separating concerns requires more discussion. Separating technologies (HTML, CSS, JS, etc.,) is likely the wrong place for us to draw boundaries. In EUI, component state, logic, and appearance are fundamentally intertwined and require multiple technologies to accomplish the final rendered output. EUI concerns are more appropriately separated at the component level. The way we do Sass at the moment obscures this a bit, but it will become more clear as modularity is introduced. That being said, globals are tricky in any case for EUI, and I think the current state of this PR helps address some of those and raises some really good discussion as we move toward future system choices. |
That's a fantastic summary @thompsongl! Thanks for taking the time to pitch in! |
@johnbarrierwilson Is this ready for review? Just wasn't sure based on your comment above:
|
@cchaos Sorry, was out on Wednesday. Yes, this is ready for review now. |
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 couldn't pull the changes to test locally because there's now a conflict, but doing a quick look through the files it looks like everything should still compile correctly. My comments are mainly suggestions for more consolidation.
EuiTooltip
We should move this mixin and variables files as well because they're prominently re-used in Kibana.
EuiPanel
Since we're already marking this as a breaking change, I'd really like to make a change to the panel mixin. It requires a "selector" but really it's asking for just the string portion of a class by automatically prepending with a .
.
eui/src/global_styling/mixins/_panel.scss
Line 10 in fbcef8b
.#{$selector} { |
Could you change this so that it just takes the full selector like @include euiPanel(.panel)
?
Also it seems the $euiPanelBorderColor
variable isn't used anywhere and should be removed.
…lson/eui into eui-amsterdam/architecture
Alrighty, those changes should be good-to-go.
|
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.
Make sure to move the changelog entry to the 'master' section. We've had a release since the last update.
and removing the `.` portion of the selector
- Moved range variables into form - Moved keyframes into utility/_animations - Moved button_toggle mixin out of buttons and back into component specific folder - Moved euiHiddenSelectableInput from switch specific to form - Moved hexToRGB function from helper mixin to color function file
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.
@johnbarrierwilson I just pushed you a couple of commits. Mainly moving a couple more mixins/variables around. It was easier/quicker for me to go ahead and do it because of my deep knowledge of the tokens.
I just had one more comment about the changelog, but other than that, it LGTM!
Co-Authored-By: Caroline Horn <549577+cchaos@users.noreply.github.com>
@cchaos Awesome! Thanks for walking me through my first contribution to EUI! 😊 |
Summary
In order to create themes more easily, this PR will move component mixins that are used in more than one component—for example, euiPanel is used in the panel, card and droppable components—to the
src/global_styling/mixins
directory. Practically, this sets the foundation for doing more extensive work for EUI Amsterdam.Mixins
Mixins that need moving to
src/global_styling
:components/button/_mixins.scss
components/form/_mixins.scss
components/form/form_control_layout/_mixins.scss
components/form/switch/_mixins.scss
components/loading/_mixins.scss
components/panel/_mixins.scss
components/popover/_mixins.scss
Checklist
- [ ] Props have proper autodocs- [ ] Added documentation examples- [ ] Added or updated jest tests- [ ] Checked for accessibility including keyboard-only and screenreader modes