-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MCR-4590: cms and state sees approval banner (#2948)
* Add new banner component * Order reviewStatusActions by latest first. * Add approval test mock * Show approval banner * Tests for approval function, approval banner, and refactor iterable tests. * Add another timeout for vitest to look for loading state * Add optional note to approval banner.
- Loading branch information
1 parent
6335b35
commit 4929bb0
Showing
7 changed files
with
487 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
services/app-web/src/components/Banner/SubmissionApprovedBanner/SubmissionApprovedBanner.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Alert } from '@trussworks/react-uswds' | ||
import React from 'react' | ||
import styles from '../Banner.module.scss' | ||
import { getUpdatedByDisplayName } from '../../../gqlHelpers' | ||
import { formatBannerDate } from '../../../common-code/dateHelpers' | ||
import { UpdatedBy } from '../../../gen/gqlClient' | ||
import { ExpandableText } from '../../ExpandableText' | ||
|
||
export type ApprovalProps = { | ||
updatedBy: UpdatedBy | ||
updatedAt: Date | ||
note?: string | ||
} | ||
|
||
export const SubmissionApprovedBanner = ({ | ||
className, | ||
updatedAt, | ||
updatedBy, | ||
note, | ||
}: ApprovalProps & React.HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<Alert | ||
role="alert" | ||
type="success" | ||
heading="Status updated" | ||
headingLevel="h4" | ||
validation={true} | ||
data-testid="submissionApprovedBanner" | ||
className={className} | ||
> | ||
<div className={styles.bannerBodyText}> | ||
<p className="usa-alert__text"> | ||
<b>Status: </b> Approved | ||
</p> | ||
<p className="usa-alert__text"> | ||
<b>Updated by: </b> | ||
{getUpdatedByDisplayName(updatedBy)} | ||
</p> | ||
<p className="usa-alert__text"> | ||
<b>Updated on: </b> | ||
{formatBannerDate(updatedAt)} | ||
</p> | ||
{note && ( | ||
<ExpandableText> | ||
<b>Optional note: </b> | ||
{note} | ||
</ExpandableText> | ||
)} | ||
</div> | ||
</Alert> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.