Skip to content

Commit

Permalink
feat(beta_badge): support warning color value (#8177)
Browse files Browse the repository at this point in the history
Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
  • Loading branch information
weronikaolejniczak and cee-chen authored Nov 22, 2024
1 parent df7a98f commit cb1325b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/eui/changelogs/upcoming/8177.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Updated `EuiBetaBadge` with a new `warning` color variant
2 changes: 1 addition & 1 deletion packages/eui/src-docs/src/views/badge/beta_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from '@emotion/react';

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

const colors = ['hollow', 'accent', 'subdued'] as const;
const colors = ['hollow', 'accent', 'subdued', 'warning'] as const;

export default () => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ exports[`EuiBetaBadge props color subdued is rendered 1`] = `
</span>
`;

exports[`EuiBetaBadge props color warning is rendered 1`] = `
<span>
<span
class="euiBetaBadge emotion-euiBetaBadge-warning-m-baseline"
title="Beta"
>
Beta
</span>
</span>
`;

exports[`EuiBetaBadge props iconType 1`] = `
<span>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const euiBetaBadgeStyles = (euiThemeContext: UseEuiTheme) => {
box-shadow: inset 0 0 0 ${euiTheme.border.width.thin}
${badgeColors.hollow.borderColor};
`,
warning: css(badgeColors.warning),
// Font sizes
m: css`
font-size: ${euiFontSizeFromScale('xs', euiTheme)};
Expand Down
4 changes: 2 additions & 2 deletions packages/eui/src/components/badge/beta_badge/beta_badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { EuiIcon, IconType } from '../../icon';

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

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

export const SIZES = ['s', 'm'] as const;
Expand Down Expand Up @@ -109,7 +109,7 @@ type BadgeProps = {
*/
title?: string;
/**
* Accepts accent, subdued and hollow.
* Accepts accent, subdued, hollow and warning.
*/
color?: BetaBadgeColor;
size?: BetaBadgeSize;
Expand Down
2 changes: 1 addition & 1 deletion packages/website/docs/components/display/badge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ import React from 'react';
import { EuiBetaBadge, EuiSpacer, EuiTitle } from '@elastic/eui';
import { css } from '@emotion/react';

const colors = ['hollow', 'accent', 'subdued'] as const;
const colors = ['hollow', 'accent', 'subdued', 'warning'] as const;

export default () => (
<>
Expand Down

0 comments on commit cb1325b

Please sign in to comment.