Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x 2x | import Link from 'next/link'
import en from '../locales/en'
import fr from '../locales/fr'
import Image from 'next/image'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { icon } from '../lib/loadIcons'
import logo from '../public/wmms-blk.svg'
interface Links {
id: string
text: string
href: string
onClick?: () => void
}
interface FooterProps {
id: string
lang: 'en' | 'fr' | 'und'
btnLink: string
error?: boolean
contactLink: string
brandLinks: Links[]
target?: string
}
const Footer = ({
id = 'mscaPlaceholder',
lang = 'en',
btnLink,
error = false,
contactLink = 'https://www.canada.ca/en/contact.html',
brandLinks = [
{
href: 'mscaPlaceholderHref',
text: 'mscaPlaceholder',
onClick: () => {},
id: 'mscaPlaceholder',
},
],
target,
}: FooterProps) => {
const t = lang === 'en' ? en : fr
return (
<footer id={id} className="w-full" data-testid="footer">
<div className="bg-blue-primary">
<section
className={`sch-container flex h-[5.75rem] flex-col items-start pb-5`}
>
<h2 className="pb-2 pt-[22px] font-body font-bold text-white">
{t.mscaFooterHeading}
</h2>
<Link
className="font-body text-sm text-white hover:text-white hover:underline focus:ring-1 focus:ring-white"
data-cy="footerContactUsLink"
id="footerContactUsLink"
href={contactLink}
target={target}
locale={lang}
aria-label={t.mscaFooterContactUsText}
>
{t.mscaFooterContactUsText}
</Link>
</section>
</div>
{/* Subfooter */}
<div className="bg-gray-lightest">
<div
className={`'min-h-[86px] ' ${
error ? 'items-center' : ''
} sch-container flex justify-between`}
>
{error ? (
<div>
<a
id="top_btn"
href={btnLink}
className="float-left cursor-pointer text-sm sm:hidden"
>
{t.topOfPage}
<FontAwesomeIcon
icon={icon['chevron-up']}
className="pl-2 text-sm sm:hidden"
/>
</a>
</div>
) : (
<section className="flex items-center md:flex-row">
<nav role="navigation" aria-labelledby="accessibleSectionHeader2">
<h2 className="sr-only" id="accessibleSectionHeader2">
{t.aboutThisSite}
</h2>
<ul className="flex flex-col whitespace-nowrap pt-4 md:flex-row">
{brandLinks.map(({ href, text, onClick }, index) => {
return (
<li
key={index}
className={`${
index === 0 ? '' : 'md:list-disc'
} mb-[17px] list-inside list-none pr-4`}
>
<Link
className="font-body text-sm text-deep-blue-dark hover:underline"
onClick={onClick}
id={'footerLink' + index}
href={href}
target={target}
aria-label={text}
>
{text}
</Link>
</li>
)
})}
<li className="float-left cursor-pointer text-sm sm:hidden">
<a id="top_btn" href={btnLink}>
{t.topOfPage}
<FontAwesomeIcon
icon={icon['chevron-up']}
className="pl-2 text-sm sm:hidden"
/>
</a>
</li>
</ul>
</nav>
</section>
)}
<div
className={`${
error ? 'items-center' : 'items-end md:items-center'
} mr-[5px] flex min-h-[96px] shrink-0`}
>
<Image
className={`${
error
? 'h-[40px] w-auto'
: 'h-[25px] w-[105px] md:h-[40px] md:w-[164px]'
} my-[15px]`}
src={logo}
alt={t.footerCanadaCaAltText}
width={143}
height={34}
/>
</div>
</div>
</div>
</footer>
)
}
export default Footer
|