-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started base UI componets for banner & card, not tested, still need t…
…o style
- Loading branch information
1 parent
02e3f96
commit 47cc5a4
Showing
2 changed files
with
81 additions
and
1 deletion.
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
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,51 @@ | ||
import React, { useState } from "react"; | ||
import { Alert, Button } from "@cmsgov/design-system"; | ||
import closingX from "../images/AlertClosingX.svg"; | ||
|
||
const CLOSING_X_IMAGE = <img alt="" className="closing-x" src={closingX} />; | ||
|
||
interface NotificationBannerProps { | ||
header: string; | ||
body: string; | ||
button?: { | ||
text: string; | ||
link: string; | ||
}; | ||
} | ||
|
||
const NotificationBanner: React.FC<NotificationBannerProps> = ( | ||
props: NotificationBannerProps | ||
) => { | ||
// notification state should be grabbed from context | ||
const [showNotification, setShowNotification] = useState<boolean>(true); | ||
|
||
// closing banner invokes API call | ||
const close = () => { | ||
// TODO: make an API call to | ||
setShowNotification(false); | ||
}; | ||
|
||
if (!showNotification) return <></>; | ||
return ( | ||
<div className="alert-bar" id="alert-bar"> | ||
{/* should use cms Alert - informational */} | ||
<Alert> | ||
{/* TODO: put in flex, make button black */} | ||
<h2 className="s-c-alert__heading">{props.header}</h2> | ||
<p className="ds-c-alert__text">{props.body}</p> | ||
{props.button && ( | ||
<Button href={props.button.link}>{props.button.text}</Button> | ||
)} | ||
<button | ||
aria-label={"Dismiss alert"} | ||
className="close-button" | ||
onClick={close} | ||
> | ||
{CLOSING_X_IMAGE} | ||
</button> | ||
</Alert> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotificationBanner; |