Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/true-spiders-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sumup-oss/circuit-ui": minor
---

Added `promo` variant for `InlineNotification`.
9 changes: 8 additions & 1 deletion packages/circuit-ui/components/Notification/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ import {
Confirm,
Info,
Notify,
Sparkles,
type IconComponentType,
} from '@sumup-oss/icons';

export type NotificationVariant = 'info' | 'success' | 'warning' | 'danger';
export type NotificationVariant =
| 'info'
| 'success'
| 'warning'
| 'danger'
| 'promo';

export const NOTIFICATION_ICONS: Record<
NotificationVariant,
Expand All @@ -31,6 +37,7 @@ export const NOTIFICATION_ICONS: Record<
success: Confirm,
warning: Notify,
danger: Alert,
promo: Sparkles,
};

export const TRANSITION_DURATION = 200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The `NotificationInline` component renders an inline notification within the con
- Use the 'success' variant the successful messages.
- Use the 'warning' variant for warning messages, and other information a user should be aware of.
- Use the 'danger' variant for error messages. Be descriptive and give users clear next steps.
- Use the 'promo' variant for promotional messages or recommendations.

### Dismissable notifications

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
color: var(--cui-fg-danger);
}

.promo {
background-color: var(--cui-bg-promo);
}

.promo .icon {
color: var(--cui-fg-promo);
}

.content {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ describe('NotificationInline', () => {
});
});

it.each([
'info',
'success',
'warning',
'danger',
'promo',
] as const)('should render the %s variant', async (variant) => {
renderNotificationInline({
...baseProps,
variant,
});

await waitFor(() => {
expect(screen.getByText(baseProps.body)).toBeVisible();
});
});

it('should render notification inline with headline', () => {
renderNotificationInline({
...baseProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
tags: ['status:stable'],
};

const variants = ['info', 'success', 'warning', 'danger'] as const;
const variants = ['info', 'success', 'warning', 'danger', 'promo'] as const;

export const Base = (args: NotificationInlineProps) => (
<NotificationInline {...args} isVisible={true} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
color: var(--cui-fg-danger);
}

.promo {
background-color: var(--cui-bg-promo);
}

.promo .icon {
color: var(--cui-fg-promo);
}

.content {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The `NotificationInline` component renders an inline notification within the con
- Use the 'success' variant the successful messages.
- Use the 'warning' variant for warning messages, and other information a user should be aware of.
- Use the 'danger' variant for error messages. Be descriptive and give users clear next steps.
- Use the 'promo' variant for promotional messages or recommendations.

### Dismissable notifications

Expand Down
Loading