-
Notifications
You must be signed in to change notification settings - Fork 843
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
Changing the way EuiCard inherits EuiPanel #415
Conversation
Having EuiPanel > EuiCard doesn’t work because it still needs `display: flex` on EuiPanel but the order in which the SASS files are loaded doesn’t allow for EuiCard styles to override EuiPanel.
This reverts commit d980560.
EuiPanel now has a mixin that can be used by any component. EuiCard uses this mixin to inherit the styles of EuiPanel but doesn’t have specificity/order issues.
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 just had a couple thoughts
src/components/card/_card.scss
Outdated
.euiCard { | ||
display: flex; | ||
flex-direction: column; | ||
overflow: hidden; | ||
padding: $euiCardSpacing; | ||
|
||
> * { |
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 avoid this by putting these styles on the descendent classes themselves, e.g. euiCard__top
, euiCard__content
and euiCard__footer
? I used to love doing stuff like this but I have always ended up regretting it.
src/components/card/card.js
Outdated
@@ -50,41 +48,60 @@ export const EuiCard = ({ | |||
); | |||
} | |||
|
|||
const OuterElement = onClick ? 'button' : 'div'; | |||
const InnerElement = onClick ? 'span' : 'div'; |
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.
Why not just leave this a span in all cases?
* - EuiCard | ||
*/ | ||
@mixin euiPanel($selector){ | ||
@if variable-exists(selector) == false { |
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 really neat, I've never seen this sort of mixin before in Sass. TIL.
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'm trying to get better at writing error messages for Sass
Spans always and no universal selector
EuiPanel now has a mixin that can be used by any component. EuiCard uses this mixin to inherit the styles of EuiPanel but doesn’t have specificity/order issues.
Fixes #408