Skip to content
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

Merged
merged 7 commits into from
Feb 16, 2018

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Feb 15, 2018

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
screen shot 2018-02-15 at 15 52 20 pm

cchaos added 4 commits February 15, 2018 14:18
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.
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.
Copy link
Contributor

@cjcenizal cjcenizal left a 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

.euiCard {
display: flex;
flex-direction: column;
overflow: hidden;
padding: $euiCardSpacing;

> * {
Copy link
Contributor

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.

@@ -50,41 +48,60 @@ export const EuiCard = ({
);
}

const OuterElement = onClick ? 'button' : 'div';
const InnerElement = onClick ? 'span' : 'div';
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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
@cchaos cchaos merged commit 1b02d52 into elastic:master Feb 16, 2018
@cchaos cchaos deleted the 408-cards-alignment branch February 16, 2018 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants