Skip to content

Changing the way EuiCard inherits EuiPanel#415

Merged
cchaos merged 7 commits intoelastic:masterfrom
cchaos:408-cards-alignment
Feb 16, 2018
Merged

Changing the way EuiCard inherits EuiPanel#415
cchaos merged 7 commits intoelastic:masterfrom
cchaos:408-cards-alignment

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.
@cchaos cchaos requested review from cjcenizal and snide February 15, 2018 20:53
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

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.

}

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