-
Notifications
You must be signed in to change notification settings - Fork 2
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
f020a42
commit e612f1c
Showing
7 changed files
with
169 additions
and
9 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
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,111 @@ | ||
import { graphql, useFragment } from "react-relay"; | ||
import type { ExternalLayout_session$key } from "ExternalLayout_session.graphql"; | ||
import getConfig from "next/config"; | ||
import Navigation from "components/Layout/Navigation"; | ||
import Footer from "components/Layout/Footer"; | ||
import SiteNoticeBanner from "components/Layout/SiteNoticeBanner"; | ||
import UserProfile from "components/User/UserProfile"; | ||
import GlobalAlert from "./GlobalAlert"; | ||
import { useContext } from "react"; | ||
import { ErrorContext } from "contexts/ErrorContext"; | ||
|
||
import footerLinks from "data/externalLinks/footerLinks"; | ||
import subHeaderLinks from "data/externalLinks/subHeaderLinks"; | ||
const runtimeConfig = getConfig()?.publicRuntimeConfig ?? {}; | ||
|
||
interface Props { | ||
title?: string; | ||
session: ExternalLayout_session$key; | ||
leftSideNav?: React.ReactNode; | ||
} | ||
|
||
const ExternalLayout: React.FC<Props> = ({ | ||
children, | ||
title, | ||
session: sessionFragment, | ||
leftSideNav, | ||
}) => { | ||
const session = useFragment( | ||
graphql` | ||
fragment ExternalLayout_session on KeycloakJwt { | ||
cifUserBySub { | ||
...UserProfile_user | ||
} | ||
} | ||
`, | ||
sessionFragment | ||
); | ||
|
||
const { error } = useContext(ErrorContext); | ||
|
||
return ( | ||
<div id="page-wrap"> | ||
<Navigation | ||
links={subHeaderLinks} | ||
isLoggedIn={Boolean(session)} | ||
title={title} | ||
userProfileComponent={ | ||
<UserProfile user={session ? session.cifUserBySub : null} /> | ||
} | ||
> | ||
{runtimeConfig.SITEWIDE_NOTICE && ( | ||
<SiteNoticeBanner content={runtimeConfig.SITEWIDE_NOTICE} /> | ||
)} | ||
</Navigation> | ||
{error && <GlobalAlert error={error} />} | ||
<div id="page-content"> | ||
{leftSideNav && <nav aria-label="side navigation">{leftSideNav}</nav>} | ||
<main>{children}</main> | ||
</div> | ||
<Footer links={footerLinks} /> | ||
<style jsx> | ||
{` | ||
#page-wrap { | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
background-color: #fafafc; | ||
} | ||
#page-content { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: flex-start; | ||
margin: auto; | ||
margin-top: 0; | ||
} | ||
main, | ||
nav { | ||
padding: 30px 40px; | ||
flex-grow: 1; | ||
} | ||
main { | ||
width: 100vw; | ||
} | ||
@media (min-width: 1024px) { | ||
#page-content { | ||
flex-direction: row; | ||
} | ||
nav { | ||
position: sticky; | ||
top: 30px; | ||
padding-right: 0; | ||
} | ||
main { | ||
min-width: 700px; | ||
width: 100%; | ||
} | ||
} | ||
`} | ||
</style> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ExternalLayout; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const footerLinks = [ | ||
{ | ||
name: "Program Details", | ||
href: "https://alpha.gov.bc.ca/gov/content/environment/climate-change/industry/cleanbc-industry-fund", | ||
}, | ||
{ | ||
name: "Disclaimer", | ||
href: "https://www2.gov.bc.ca/gov/content/home/disclaimer", | ||
}, | ||
{ | ||
name: "Privacy", | ||
href: "https://www2.gov.bc.ca/gov/content/home/privacy", | ||
}, | ||
{ | ||
name: "Accessibility", | ||
href: "https://www2.gov.bc.ca/gov/content/home/accessible-government", | ||
}, | ||
{ | ||
name: "Copywrite", | ||
href: "https://www2.gov.bc.ca/gov/content/home/copyright", | ||
}, | ||
]; | ||
|
||
export default footerLinks; |
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,14 @@ | ||
const subHeaderLinks = [ | ||
{ | ||
name: "Email Us", | ||
href: { pathname: "mailto:[email protected]" }, | ||
highlightOn: ["/cif/operator(.*)"], | ||
}, | ||
{ | ||
name: "Contact Information", | ||
href: { pathname: "#" }, | ||
highlightOn: ["/cif/contact(.*)"], | ||
}, | ||
]; | ||
|
||
export default subHeaderLinks; |