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

Added null as acceptable icon for EuiCard #3470

Merged
merged 7 commits into from
May 13, 2020
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
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `null` as acceptable `icon` prop for `EuiCard` ([#3470](https://github.com/elastic/eui/pull/3470))
- Added `sortBy` and `sortShift` props to `euiPaletteColorBlind()` for sorting along the color wheel ([#3387](https://github.com/elastic/eui/pull/3387))
- Added `utcOffset` prop to `EuiSuperDatePicker` ([#3436](https://github.com/elastic/eui/pull/3436))
- Added `partition` key to `EuiChartThemeType` for Partition chart support ([#3387](https://github.com/elastic/eui/pull/3387))
Expand Down
25 changes: 25 additions & 0 deletions src/components/card/__snapshots__/card.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@ exports[`EuiCard is rendered 1`] = `
</div>
`;

exports[`EuiCard props a null icon 1`] = `
<div
class="euiCard euiCard--centerAligned"
>
<div
class="euiCard__content"
>
<span
class="euiTitle euiTitle--small euiCard__title"
id="generated-idTitle"
>
Card title
</span>
<div
class="euiText euiText--small euiCard__description"
id="generated-idDescription"
>
<p>
Card description
</p>
</div>
</div>
</div>
`;

exports[`EuiCard props children 1`] = `
<div
class="euiCard euiCard--centerAligned euiCard--hasChildren"
Expand Down
12 changes: 12 additions & 0 deletions src/components/card/card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ describe('EuiCard', () => {
expect(component).toMatchSnapshot();
});

test('a null icon', () => {
const component = render(
<EuiCard
title="Card title"
description="Card description"
icon={null}
/>
);

expect(component).toMatchSnapshot();
});

test('horizontal', () => {
const component = render(
<EuiCard
Expand Down
4 changes: 2 additions & 2 deletions src/components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ type EuiCardProps = Omit<CommonProps, 'aria-label'> & {
description: NonNullable<ReactNode>;

/**
* Requires a <EuiIcon> node
* Accepts an `<EuiIcon>` node or `null`
*/
icon?: ReactElement<EuiIconProps>;
icon?: ReactElement<EuiIconProps> | null;

/**
* Accepts a url in string form or ReactElement for a custom image component
Expand Down