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

Card theme title parity and margin fix #704

Merged
merged 3 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Bug fixes**

- Fixed inherited `line-height` of inputs and buttons ([#702](https://github.com/elastic/eui/pull/702))
- Fixed card title sizing in K6 theme. ([#704](https://github.com/elastic/eui/pull/704))

## [`0.0.43`](https://github.com/elastic/eui/tree/v0.0.43)

Expand Down
3 changes: 0 additions & 3 deletions src/components/card/__snapshots__/card.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ exports[`EuiCard is rendered 1`] = `
class="euiCard euiCard--centerAligned testClass1 testClass2"
data-test-subj="test subject string"
>
<span
class="euiCard__top"
/>
<span
class="euiCard__content"
>
Expand Down
11 changes: 8 additions & 3 deletions src/components/card/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import "../panel/mixins";

$euiCardSpacing: map-get($euiPanelPaddingModifiers, "paddingMedium");
$euiCardTitleSize: 18px; // Hardcoded pixel value for theme parity.

// Start with a base of EuiPanel styles
@include euiPanel($selector: 'euiCard');
Expand Down Expand Up @@ -79,14 +80,18 @@ $euiCardSpacing: map-get($euiPanelPaddingModifiers, "paddingMedium");
}
}

// If an icon or image exists, add some space
.euiCard__top + .euiCard__content {
margin-top: $euiCardSpacing;
}

.euiCard__content {
flex-grow: 1; /* 1 */

.euiCard__title {
display: block;
margin-top: $euiCardSpacing;
@include euiTitle($euiFontSizeM);
font-weight: $euiFontWeightRegular;
@include euiTitle($euiCardTitleSize);
font-weight: $euiFontWeightMedium;
}

.euiCard__description {
Expand Down
16 changes: 12 additions & 4 deletions src/components/card/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,25 @@ export const EuiCard = ({
OuterElement = 'button';
}

let optionalCardTop;
if (image || icon) {
optionalCardTop = (
<span className="euiCard__top">
{imageNode}
{iconNode}
</span>
);
}

return (
<OuterElement
onClick={onClick}
className={classes}
href={href}
{...rest}
>
<span className="euiCard__top">
{imageNode}
{iconNode}
</span>

{optionalCardTop}

<span className="euiCard__content">
<EuiTitle className="euiCard__title">
Expand Down