Skip to content
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 packages/eui/changelogs/upcoming/8303.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added `accent` color option to `EuiCallOut`
19 changes: 19 additions & 0 deletions packages/eui/src-docs/src/views/call_out/accent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

import { EuiCallOut, EuiLink } from '../../../../src';

export default () => (
<EuiCallOut
title="Shiny new thing has arrived"
color="accent"
iconType="cheer"
>
<p>
Dull thing can now be forgotten.{' '}
<EuiLink external href="#">
Learn more
</EuiLink>
.
</p>
</EuiCallOut>
);
26 changes: 26 additions & 0 deletions packages/eui/src-docs/src/views/call_out/call_out_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ const dangerSnippet = [
`,
];

import Accent from './accent';
const accentSource = require('!!raw-loader!./accent');
const accentSnippet = [
`<EuiCallOut title="Shiny new thing has arrived" color="accent" iconType="cheer">
<p><!-- Content --></p>
</EuiCallOut>
`,
];

import OnDismiss from './on_dismiss';
const onDismissSource = require('!!raw-loader!./on_dismiss');
const onDismissSnippet = [
Expand Down Expand Up @@ -173,6 +182,23 @@ export const CallOutExample = {
snippet: dangerSnippet,
demo: <Danger />,
},
{
title: 'Accent',
source: [
{
type: GuideSectionTypes.TSX,
code: accentSource,
},
],
text: (
<p>
Use this callout to announce new capabilities. For example if you want
to highlight a feature.
</p>
),
snippet: accentSnippet,
demo: <Accent />,
},
{
title: 'Dismissible callouts',
source: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ exports[`EuiCallOut is rendered 1`] = `
</div>
`;

exports[`EuiCallOut props color accent is rendered 1`] = `
<div
class="euiPanel euiPanel--accent euiPanel--paddingMedium euiCallOut euiCallOut--accent emotion-euiPanel-none-m-accent-euiCallOut"
/>
`;

exports[`EuiCallOut props color danger is rendered 1`] = `
<div
class="euiPanel euiPanel--danger euiPanel--paddingMedium euiCallOut euiCallOut--danger emotion-euiPanel-none-m-danger-euiCallOut"
Expand Down
3 changes: 3 additions & 0 deletions packages/eui/src/components/call_out/call_out.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export const euiCallOutHeaderStyles = ({ euiTheme }: UseEuiTheme) => {
danger: css`
color: ${euiTheme.colors.dangerText};
`,
accent: css`
color: ${euiTheme.colors.accentText};
`,
euiCallOut__icon: css`
position: relative;
${logicalCSS('top', '-1px')}
Expand Down
8 changes: 7 additions & 1 deletion packages/eui/src/components/call_out/call_out.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ import { EuiI18n } from '../i18n';

import { euiCallOutStyles, euiCallOutHeaderStyles } from './call_out.styles';

export const COLORS = ['primary', 'success', 'warning', 'danger'] as const;
export const COLORS = [
'primary',
'success',
'warning',
'danger',
'accent',
] as const;
export type Color = (typeof COLORS)[number];

export const HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'] as const;
Expand Down
20 changes: 20 additions & 0 deletions packages/website/docs/components/display/callout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ export default () => (
);
```

## Accent

Use this callout to announce new capabilities. For example if you want to highlight a feature.

```tsx interactive
import React from 'react';
import { EuiCallOut, EuiLink } from '@elastic/eui';

export default () => (
<EuiCallOut title="Shiny new thing has arrived" color="accent" iconType="cheer">
<p>
Dull thing can now be forgotten.{' '}
<EuiLink external href="#">
Learn more
</EuiLink>.
</p>
</EuiCallOut>
);
```

## Dismissible callouts

To render a cross icon in the top right hand corner, pass an `onDismiss` callback that handles conditionally rendering your callout.
Expand Down