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

Add emergency type to alert component #202

Merged
merged 2 commits into from
Jul 17, 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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/comet-uswds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metrostar/comet-uswds",
"version": "2.1.2",
"version": "2.2.0",
"description": "React with TypeScript Component Library based on USWDS 3.0.",
"license": "Apache-2.0",
"main": "./dist/cjs/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/comet-uswds/src/components/alert/alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ describe('Alert', () => {
expect(container.querySelector('#alert')).toHaveClass('usa-alert--success');
});

test('should render an emergency alert', () => {
const { container } = render(<Alert id="alert" type="emergency" />);
expect(container.querySelector('#alert')).toHaveClass('usa-alert--emergency');
});

test('should render a slim alert', () => {
const { container } = render(<Alert id="alert" type="info" slim={true} />);
expect(container.querySelector('#alert')).toHaveClass('usa-alert--slim');
Expand Down
3 changes: 2 additions & 1 deletion packages/comet-uswds/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface AlertProps {
/**
* The type of alert to display
*/
type: 'info' | 'warning' | 'error' | 'success';
type: 'info' | 'warning' | 'error' | 'success' | 'emergency';
/**
* Whether or not to display the alert
*/
Expand Down Expand Up @@ -53,6 +53,7 @@ export const Alert = ({
'usa-alert--success': type === 'success',
'usa-alert--warning': type === 'warning',
'usa-alert--error': type === 'error',
'usa-alert--emergency': type === 'emergency',
'usa-alert--info': type === 'info',
'usa-alert--slim': slim,
'usa-alert--no-icon': noIcon,
Expand Down
Loading