diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d7e33c073..849fff23726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [`master`](https://github.com/elastic/eui/tree/master) +- Added conditional rendering of the title element in `EuiCallOut` to avoid usage of additional space caused by the rendered `
` element ([#3549](https://github.com/elastic/eui/pull/3549)) + **Bug fixes** - Fixed `EuiKeyPadMenu` and `EuiKeyPadMenuItem` aria roles ([#3502](https://github.com/elastic/eui/pull/3502)) diff --git a/src/components/call_out/__snapshots__/call_out.test.tsx.snap b/src/components/call_out/__snapshots__/call_out.test.tsx.snap index aa847b786ef..12716d53977 100644 --- a/src/components/call_out/__snapshots__/call_out.test.tsx.snap +++ b/src/components/call_out/__snapshots__/call_out.test.tsx.snap @@ -6,13 +6,6 @@ exports[`EuiCallOut is rendered 1`] = ` class="euiCallOut euiCallOut--primary testClass1 testClass2" data-test-subj="test subject string" > -
- -
@@ -24,174 +17,73 @@ exports[`EuiCallOut is rendered 1`] = ` exports[`EuiCallOut props color danger is rendered 1`] = `
-
- -
-
+/> `; exports[`EuiCallOut props color primary is rendered 1`] = `
-
- -
-
+/> `; exports[`EuiCallOut props color success is rendered 1`] = `
-
- -
-
+/> `; exports[`EuiCallOut props color warning is rendered 1`] = `
-
- -
-
+/> `; exports[`EuiCallOut props heading h1 is rendered 1`] = `
-
-

-

-
+/> `; exports[`EuiCallOut props heading h2 is rendered 1`] = `
-
-

-

-
+/> `; exports[`EuiCallOut props heading h3 is rendered 1`] = `
-
-

-

-
+/> `; exports[`EuiCallOut props heading h4 is rendered 1`] = `
-
-

-

-
+/> `; exports[`EuiCallOut props heading h5 is rendered 1`] = `
-
-
-
-
+/> `; exports[`EuiCallOut props heading h6 is rendered 1`] = `
-
-
-
-
+/> `; exports[`EuiCallOut props heading p is rendered 1`] = `
-
-

-

-
+/> `; exports[`EuiCallOut props iconType is rendered 1`] = `
-
- -
+/> `; exports[`EuiCallOut props title is rendered 1`] = ` diff --git a/src/components/call_out/call_out.tsx b/src/components/call_out/call_out.tsx index 465d5a42325..35322ecceea 100644 --- a/src/components/call_out/call_out.tsx +++ b/src/components/call_out/call_out.tsx @@ -92,14 +92,19 @@ export const EuiCallOut: FunctionComponent = ({ } const H: any = heading ? `${heading}` : 'span'; + let header; - return ( -
+ if (title) { + header = (
{headerIcon} - {title}
+ ); + } + return ( +
+ {header} {optionalChildren}