-
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.
- Loading branch information
1 parent
97e2f1e
commit 6ae1ffd
Showing
7 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,90 @@ | ||
import { Link as RouterLink, useParams } from "react-router-dom"; | ||
import { Flex, Container, Image, Link, Text } from "@chakra-ui/react"; | ||
import { useStore } from "utils"; | ||
import checkIcon from "assets/icons/check/icon_check_gray.png"; | ||
import { ReportType } from "types/report"; | ||
|
||
export const SubnavBar = () => { | ||
const { reportType } = useParams(); | ||
const { report, lastSavedTime } = useStore(); | ||
const saveStatusText = "Last saved " + lastSavedTime; | ||
return ( | ||
<Flex sx={sx.subnavBar}> | ||
<Container sx={sx.subnavContainer}> | ||
<Flex sx={sx.subnavFlex}> | ||
<Flex> | ||
<Text sx={sx.submissionNameText}> | ||
{reportType == ReportType.QM ? report?.state + " QMS Report" : ""} | ||
</Text> | ||
</Flex> | ||
<Flex sx={sx.subnavFlexRight}> | ||
{lastSavedTime && ( | ||
<> | ||
<Image | ||
src={checkIcon} | ||
alt="gray checkmark icon" | ||
sx={sx.checkIcon} | ||
/> | ||
<Text sx={sx.saveStatusText}>{saveStatusText}</Text> | ||
</> | ||
)} | ||
<Link | ||
as={RouterLink} | ||
to={`/report/${report?.type}/${report?.state}` || "/"} | ||
sx={sx.leaveFormLink} | ||
variant="outlineButton" | ||
tabIndex={-1} | ||
> | ||
Leave form | ||
</Link> | ||
</Flex> | ||
</Flex> | ||
</Container> | ||
</Flex> | ||
); | ||
}; | ||
|
||
const sx = { | ||
subnavBar: { | ||
position: "sticky", | ||
top: 0, | ||
zIndex: "sticky", | ||
bg: "palette.secondary_lightest", | ||
boxShadow: "0px 4px 4px rgba(0, 0, 0, 0.25)", | ||
}, | ||
subnavContainer: { | ||
maxW: "appMax", | ||
".desktop &": { | ||
padding: "0 2rem", | ||
}, | ||
}, | ||
subnavFlex: { | ||
height: "60px", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
}, | ||
leaveFormLink: { | ||
marginLeft: "1rem", | ||
}, | ||
checkIcon: { | ||
marginRight: "0.5rem", | ||
boxSize: "1rem", | ||
".mobile &": { | ||
display: "none", | ||
}, | ||
}, | ||
submissionNameText: { | ||
fontWeight: "bold", | ||
}, | ||
saveStatusText: { | ||
fontSize: "sm", | ||
".mobile &": { | ||
width: "5rem", | ||
textAlign: "right", | ||
}, | ||
}, | ||
subnavFlexRight: { | ||
alignItems: "center", | ||
paddingRight: ".5rem", | ||
}, | ||
}; |
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
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