Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add warning in badge #1208 #1210

Merged
merged 1 commit into from
Nov 29, 2024
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
4 changes: 4 additions & 0 deletions projects/ion/src/lib/badge/_badge.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ $default: (
background-color: ion-theme(negative-6),
text-color: ion-theme(positive-1),
),
warning: (
background-color: ion-theme(warning-6),
text-color: ion-theme(neutral-1),
),
);

@include register-component(
Expand Down
2 changes: 1 addition & 1 deletion projects/ion/src/lib/badge/badge.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
}

@each $variant in primary, secondary, neutral, negative {
@each $variant in primary, secondary, neutral, negative, warning {
.badge-#{$variant} {
background-color: ion-theme(badge-#{$variant}-background-color);
color: ion-theme(badge-#{$variant}-text-color);
Expand Down
2 changes: 1 addition & 1 deletion projects/ion/src/lib/badge/badge.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('BadgeComponent', () => {
}
);

it.each(['primary', 'secondary', 'neutral', 'negative'])(
it.each(['primary', 'secondary', 'neutral', 'negative', 'warning'])(
'should render 99+ when value is %i (bigger than 100)',
async (type: BadgeType) => {
await sut({ type, label: type });
Expand Down
7 changes: 6 additions & 1 deletion projects/ion/src/lib/core/types/badge.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { IconType } from './icon';

export type BadgeType = 'primary' | 'secondary' | 'neutral' | 'negative';
export type BadgeType =
| 'primary'
| 'secondary'
| 'neutral'
| 'negative'
| 'warning';

export interface BadgeProps {
label?: string;
Expand Down
Loading