-
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.
Merge pull request #77 from NASA-PDS/features/create-banner-component
Create banner component
- Loading branch information
Showing
5 changed files
with
125 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.pds-wds-react-banner { | ||
|
||
color: var(--pds-primary-white); | ||
padding: 10px 0px; | ||
text-align: left; | ||
|
||
span.title { | ||
white-space: nowrap; | ||
} | ||
|
||
a { | ||
|
||
display: flex; | ||
direction: column; | ||
gap: 4px; | ||
align-items: center; | ||
color: var(--pds-primary-white); | ||
border-radius: 8px; | ||
white-space: nowrap; | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
text-decoration-style: dashed; | ||
text-underline-offset: .3em; | ||
} | ||
|
||
span.icon { | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: var(--pds-primary-white); | ||
border-radius: 8px; | ||
height: 16px; | ||
width: 16px; | ||
|
||
&.info { | ||
color: var(--pds-secondary-blue-s1); | ||
} | ||
|
||
&.alert { | ||
color: var(--pds-secondary-red-s1); | ||
} | ||
|
||
& svg { | ||
height: 10px; | ||
width: 10px; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
&.info { | ||
background-color: var(--pds-secondary-blue-s1); | ||
} | ||
|
||
&.alert { | ||
background-color: var(--pds-secondary-red-s1); | ||
} | ||
|
||
} |
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,60 @@ | ||
import React from "react"; | ||
import { | ||
Grid as MuiGrid, | ||
Box as MuiBox, | ||
Container as MuiContainer, | ||
Stack as MuiStack | ||
} from "@mui/material"; | ||
import { | ||
IconArrowDiagonal, | ||
IconArrowRight, | ||
} from "../Icons"; | ||
import { Typography } from "../Typography"; | ||
import { Link } from "react-router-dom"; | ||
|
||
type Link = { | ||
href:string; | ||
title:string; | ||
type:"internal" | "external"; | ||
} | ||
|
||
export type BannerProps = { | ||
link?:Link; | ||
message:string; | ||
title:string; | ||
variant?:"info" | "alert" | ||
} | ||
|
||
export const Banner = ( | ||
{ | ||
link, | ||
message, | ||
title, | ||
variant = "info" | ||
}:BannerProps | ||
) => { | ||
|
||
return <React.Fragment> | ||
<MuiBox className={'pds-wds-react-banner ' + variant}> | ||
<MuiContainer maxWidth={"xl"}> | ||
<MuiGrid container> | ||
<MuiGrid xs={12} lg={8}> | ||
<MuiStack direction={{xs: "column", sm: "row"}} gap={{xs: "8px", sm:"32px"}} alignItems={{xs: "flex-start", sm:"center"}} justifyContent={"flex-start"}> | ||
<MuiStack direction={{xs: "column", sm: "row"}} gap={"8px"} alignItems={{xs: "flex-start", sm: "center"}} justifyContent={"flex-start"}> | ||
<Typography variant="h5" weight="semibold" component="span" className="title">{title}</Typography> | ||
<Typography variant="h6" weight="regular" component="span">{message}</Typography> | ||
</MuiStack> | ||
{ link && | ||
<Link to={link.href}> | ||
<Typography variant="h6" weight="semibold" component={"span"}>{link.title}</Typography> | ||
<span className={"icon " + variant}>{link.type ? <IconArrowRight /> : <IconArrowDiagonal />}</span> | ||
</Link> | ||
} | ||
</MuiStack> | ||
</MuiGrid> | ||
</MuiGrid> | ||
</MuiContainer> | ||
</MuiBox> | ||
</React.Fragment> | ||
|
||
} |
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 @@ | ||
export * from "./Banner"; |
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