Skip to content

Commit

Permalink
add success color to notification badge
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelrio committed Jun 21, 2023
1 parent 1341b12 commit 7bb2222
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src-docs/src/views/badge/notification_badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import React from 'react';

import { EuiNotificationBadge } from '../../../../src/components/badge/notification_badge';
import {
EuiFlexGroup,
EuiFlexItem,
EuiNotificationBadge,
} from '../../../../src/components';

export default () => <EuiNotificationBadge>3</EuiNotificationBadge>;
export default () => (
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={false}>
<EuiNotificationBadge>3</EuiNotificationBadge>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiNotificationBadge color="success">3</EuiNotificationBadge>
</EuiFlexItem>
</EuiFlexGroup>
);
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ exports[`EuiNotificationBadge props color subdued is rendered 1`] = `
</span>
`;

exports[`EuiNotificationBadge props color success is rendered 1`] = `
<span
class="euiNotificationBadge emotion-euiNotificationBadge-s-success"
>
5
</span>
`;

exports[`EuiNotificationBadge props size m is rendered 1`] = `
<span
class="euiNotificationBadge emotion-euiNotificationBadge-m-accent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
mathWithUnits,
} from '../../../global_styling';
import { UseEuiTheme, tint } from '../../../services';

import { euiButtonFillColor } from '../../../themes/amsterdam/global_styling/mixins';
import { getBadgeColors } from '../beta_badge/beta_badge.styles';

export const euiNotificationBadgeStyles = (euiThemeContext: UseEuiTheme) => {
Expand Down Expand Up @@ -57,6 +57,11 @@ export const euiNotificationBadgeStyles = (euiThemeContext: UseEuiTheme) => {
accent: css`
${getBadgeColors(euiTheme.colors.accentText, euiThemeContext)}
`,
success: css`
background-color: ${euiButtonFillColor(euiThemeContext, 'success')
.backgroundColor};
color: ${euiTheme.colors.ink};
`,
subdued: css`
${getBadgeColors(tint(euiTheme.colors.lightShade, 0.3), euiThemeContext)}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useEuiTheme } from '../../../services';

import { euiNotificationBadgeStyles } from './badge_notification.styles';

export const COLORS = ['accent', 'subdued'] as const;
export const COLORS = ['accent', 'subdued', 'success'] as const;
export type BadgeNotificationColor = (typeof COLORS)[number];

export const SIZES = ['s', 'm'] as const;
Expand Down

0 comments on commit 7bb2222

Please sign in to comment.