generated from DTS-STN/next-template
-
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.
Merge pull request #893 from DTS-STN/update-header
Replace DS Header
- Loading branch information
Showing
11 changed files
with
185 additions
and
10 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
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,41 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { faChevronRight as solidChevronRight } from '@fortawesome/free-solid-svg-icons' | ||
|
||
export interface BreadcrumbItem { | ||
text: string | ||
link: string | ||
} | ||
|
||
interface BreadcrumbProps { | ||
items?: BreadcrumbItem[] | ||
locale: string | ||
} | ||
|
||
export function Breadcrumb({ locale, items = [] }: BreadcrumbProps) { | ||
return ( | ||
<nav aria-label="breadcrumbs"> | ||
<ul className="block text-base font-body mt-6"> | ||
{items.map((item, index) => ( | ||
<li | ||
key={item.link} | ||
className="inline-block min-w-0 max-w-full truncate -my-4 px-1" | ||
> | ||
<FontAwesomeIcon | ||
icon={solidChevronRight} | ||
className={`${ | ||
index === 0 ? 'hidden' : '' | ||
} h-[8px] w-[8px] py-[2px] pr-[4px]`} | ||
/> | ||
<Link href={item.link} locale={locale}> | ||
<a className="font-sans text-[16px] leading-[23px] font-[400] text-[#295376] hover:text-[#0535D2] underline"> | ||
{item.text} | ||
</a> | ||
</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
) | ||
} |
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,81 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
import Image from 'next/image' | ||
import { Breadcrumb, BreadcrumbItem } from './Breadcrumb' | ||
|
||
interface HeaderProps { | ||
id: string | ||
locale: string | ||
langUrl: string | ||
headerText: { | ||
skipToMainContent: string | ||
globalHeader: string | ||
testSiteNotice: string | ||
officialSiteNavigation: string | ||
languageSelection: string | ||
logoAltText: string | ||
} | ||
breadcrumbItems?: BreadcrumbItem[] | ||
} | ||
|
||
export function Header({ | ||
id, | ||
locale, | ||
langUrl, | ||
headerText, | ||
breadcrumbItems = [], | ||
}: HeaderProps) { | ||
const language = locale === 'en' ? 'fr' : 'en' | ||
const languageText = language === 'en' ? 'English' : 'Français' | ||
const shortLanguageText = language === 'en' ? 'EN' : 'FR' | ||
|
||
return ( | ||
<> | ||
<nav id={id} className="skip-main"> | ||
<a | ||
id="skipToMainContent" | ||
className="bg-white text-custom-blue-dark text-lg underline py-1 px-2 focus:outline-dark-goldenrod hover:bg-gray-dark" | ||
href="#pageMainTitle" | ||
data-cy-button="skip-Content" | ||
draggable="false" | ||
> | ||
{headerText.skipToMainContent} | ||
</a> | ||
</nav> | ||
<header> | ||
<h2 className="sr-only">{headerText.globalHeader}</h2> | ||
<h3 className="sr-only">{headerText.testSiteNotice}</h3> | ||
<div className="flex-col flex lg:flex lg:flex-row justify-between mb-4"> | ||
<div | ||
className="w-full flex flex-row justify-between items-start" | ||
role="navigation" | ||
aria-labelledby="officialSiteNav" | ||
> | ||
<h3 className="sr-only" id="officialSiteNav"> | ||
{headerText.officialSiteNavigation} | ||
</h3> | ||
<a href="https://www.canada.ca"> | ||
<Image | ||
src={language === 'en' ? '/sig-blk-fr.svg' : '/sig-blk-en.svg'} | ||
alt={headerText.logoAltText} | ||
width="375" | ||
height="35" | ||
/> | ||
</a> | ||
<h3 className="sr-only">{headerText.languageSelection}</h3> | ||
<Link href={langUrl} locale={language}> | ||
<a className="ml-6 sm:ml-16 -mt-1 underline font-lato text-[16px] leading-[23px] text-[#295376] hover:text-[#0535D2]"> | ||
<span className="md:hidden font-bold">{shortLanguageText}</span> | ||
<span className="hidden md:inline font-[400]"> | ||
{languageText} | ||
</span> | ||
</a> | ||
</Link> | ||
</div> | ||
</div> | ||
<hr className="absolute left-0 border-b-2 border-[#38414D] w-screen w-full" /> | ||
<Breadcrumb items={breadcrumbItems} locale={locale} /> | ||
</header> | ||
</> | ||
) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.