Skip to content

Commit

Permalink
Merge pull request #202 from MetroStar/emergency-alert
Browse files Browse the repository at this point in the history
Add emergency type to alert component
  • Loading branch information
jbouder authored Jul 17, 2024
2 parents 6260cb7 + ab8f497 commit bb0401e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
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

0 comments on commit bb0401e

Please sign in to comment.