Skip to content

Commit ab932f4

Browse files
feat(beta_badge): support warning color value
closes #8138
1 parent df7a98f commit ab932f4

File tree

6 files changed

+17
-4
lines changed

6 files changed

+17
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added a new color variant of the EuiBetaBadge component: `warning`. It can be set using the `color` prop: `<EuiBetaBadge color="warning" />`.

packages/eui/src-docs/src/views/badge/beta_badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
33

44
import { EuiBetaBadge, EuiSpacer, EuiTitle } from '../../../../src/components';
55

6-
const colors = ['hollow', 'accent', 'subdued'] as const;
6+
const colors = ['hollow', 'accent', 'subdued', 'warning'] as const;
77

88
export default () => (
99
<>

packages/eui/src/components/badge/beta_badge/__snapshots__/beta_badge.test.tsx.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ exports[`EuiBetaBadge props color subdued is rendered 1`] = `
6868
</span>
6969
`;
7070

71+
exports[`EuiBetaBadge props color warning is rendered 1`] = `
72+
<span>
73+
<span
74+
class="euiBetaBadge emotion-euiBetaBadge-warning-m-baseline"
75+
title="Beta"
76+
>
77+
Beta
78+
</span>
79+
</span>
80+
`;
81+
7182
exports[`EuiBetaBadge props iconType 1`] = `
7283
<span>
7384
<span

packages/eui/src/components/badge/beta_badge/beta_badge.styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const euiBetaBadgeStyles = (euiThemeContext: UseEuiTheme) => {
4949
box-shadow: inset 0 0 0 ${euiTheme.border.width.thin}
5050
${badgeColors.hollow.borderColor};
5151
`,
52+
warning: css(badgeColors.warning),
5253
// Font sizes
5354
m: css`
5455
font-size: ${euiFontSizeFromScale('xs', euiTheme)};

packages/eui/src/components/badge/beta_badge/beta_badge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { EuiIcon, IconType } from '../../icon';
2222

2323
import { euiBetaBadgeStyles } from './beta_badge.styles';
2424

25-
export const COLORS = ['accent', 'subdued', 'hollow'] as const;
25+
export const COLORS = ['accent', 'subdued', 'hollow', 'warning'] as const;
2626
export type BetaBadgeColor = (typeof COLORS)[number];
2727

2828
export const SIZES = ['s', 'm'] as const;
@@ -109,7 +109,7 @@ type BadgeProps = {
109109
*/
110110
title?: string;
111111
/**
112-
* Accepts accent, subdued and hollow.
112+
* Accepts accent, subdued, hollow and warning.
113113
*/
114114
color?: BetaBadgeColor;
115115
size?: BetaBadgeSize;

packages/website/docs/components/display/badge.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ import React from 'react';
323323
import { EuiBetaBadge, EuiSpacer, EuiTitle } from '@elastic/eui';
324324
import { css } from '@emotion/react';
325325

326-
const colors = ['hollow', 'accent', 'subdued'] as const;
326+
const colors = ['hollow', 'accent', 'subdued', 'warning'] as const;
327327

328328
export default () => (
329329
<>

0 commit comments

Comments
 (0)