-
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
Updating Popovers to use Panel Padding vars #229
Changes from 4 commits
0c4dcf0
9eb945f
93a4a0d
70bd675
0131c65
ff4b42f
841058d
655ae74
b4e45c4
c94c4c7
3f866df
bb89192
46073f0
97dd332
b6f8e45
7df7069
38c7e7a
21b5568
4a2938e
174bf8a
6afd194
2a2df38
26a173f
9cc4c0e
a7af4d2
5047dd5
e933daa
5c7d42f
93923a3
0536246
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
/** Padding map eferenced in: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nit, but for consistency can we separate the opening comment block token from the first line? /**
* Padding map referenced in:
* - Popover
*/ Also small typo: "eferenced" -> "referenced" |
||
* - Popover | ||
*/ | ||
$euiPanelPadding: ( | ||
"Small": $euiSizeS, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this pattern! I think we can make it a little easier to grep for the modifier if we use the full modifier name as the key (and use the term "modifier" in the variable names to make it clearer we're not defining an actual padding value): $euiPanelPaddingModifiers: (
".euiPanel--paddingSmall": $euiSizeS,
".euiPanel--paddingMedium": $euiSize,
".euiPanel--paddingLarge": $euiSizeL
) !default;
.euiPanel {
@include euiBottomShadowSmall;
background-color: $euiColorEmptyShade;
border: $euiBorderThin;
border-radius: $euiBorderRadius;
flex-grow: 1;
@each $modifier, $amount in $euiPanelPaddingModifiers {
&#{$modifier} {
padding: $amount;
}
}
&.euiPanel--shadow {
@include euiBottomShadow;
}
&.euiPanel--flexGrowZero {
flex-grow: 0;
}
} What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see where you're going with this in that it simplifies the (at)each statement and the popover doesn't need to hard-code the reference to the class. However, I still see too much duplication, ie. $euiPanelPaddingModifiers: (
"--paddingSmall": $euiSizeS,
"--paddingMedium": $euiSize,
"--paddingLarge": $euiSizeL
) !default;
.euiPanel {
...
@each $modifier, $amount in $euiPanelPaddingModifiers {
&.euiPanel#{$modifier} {
padding: $amount;
}
}
...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What problem are we solving by removing the duplication? For example, does duplication make it more difficult to read? To maintain?
I don't understand, could you clarify? I would think the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's a bit of both. To me, it seems to read easier having .euiPanel duplicated in the actual selector versus in a map. Also, I'm not sure that we want to start going down the road of storing full class names inside of variables. Could be a slippery slope to too many variables. |
||
"Medium": $euiSize, | ||
"Large": $euiSizeL | ||
) !default; | ||
|
||
|
||
.euiPanel { | ||
@include euiBottomShadowSmall; | ||
|
||
|
@@ -6,16 +16,10 @@ | |
border-radius: $euiBorderRadius; | ||
flex-grow: 1; | ||
|
||
&.euiPanel--paddingSmall { | ||
padding: $euiSizeS; | ||
} | ||
|
||
&.euiPanel--paddingMedium { | ||
padding: $euiSize; | ||
} | ||
|
||
&.euiPanel--paddingLarge { | ||
padding: $euiSizeL; | ||
@each $size, $amount in $euiPanelPadding { | ||
&.euiPanel--padding#{$size} { | ||
padding: $amount; | ||
} | ||
} | ||
|
||
&.euiPanel--shadow { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
@mixin euiPopoverTitle { | ||
background-color: $euiColorLightestShade; | ||
border-bottom: $euiBorderThin; | ||
padding: $euiSizeM; | ||
border-top-left-radius: $euiBorderRadius - 1; | ||
border-top-right-radius: $euiBorderRadius - 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we leave a comment here to explain why we do this? |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
.euiPopoverTitle { | ||
@include euiPopoverTitle; | ||
} | ||
|
||
// If the popover's containing panel has padding applied, | ||
// ensure the title expands to cover that padding and | ||
// take on the same amount of padding horizontally | ||
|
||
@each $size, $amount in $euiPanelPadding { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, if we can I'd rather we don't make more global variables. In the back of our head we should always consider that we're going to pull our components CSS away from each other one day and the less global settings we rely on the better. We might want to consider directly importing required variables from file to the other rather than just adding it to the global scope, similar to how JS would handle it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Importing the variables SGTM. What do you mean by pulling our components' CSS away from each other one day? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjcenizal If we were building this outside of Kibana's necessities for multi-framework solutions we likely would have built out separate CSS files per component rather than a giant monolith file that needs to be imported (which would be replaced with just a single reset / core file). Importing the one component into another would bring along all the styling you need on a layout per layout basis. One day (not anytime soon) I think we'll end up there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I thought there was a way to do sass compilation that order of the imports in the manifest doesn't matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it does not duplicate. I'll add the import |
||
.euiPopover__panel.euiPanel--padding#{$size} & { | ||
padding: $euiSizeM $amount; | ||
margin: ($amount * -1) ($amount * -1) $amount; | ||
} | ||
} | ||
|
||
} |
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 we also update the text of the buttons to also reflect that each one demonstrates a different padding size?
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're also missing an example of small padding, aren't we? Maybe we should just create a section dedicated to demonstrating the different padding options.
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.
Yeah I'll just create a new section