-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DEV-027] Footer #46
base: develop
Are you sure you want to change the base?
[DEV-027] Footer #46
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,60 @@ | ||
import { | ||
Center, | ||
Flex, | ||
GridItem, | ||
Heading, | ||
HStack, | ||
SimpleGrid, | ||
Text, | ||
useBreakpointValue, | ||
} from "@chakra-ui/react"; | ||
import React from "react"; | ||
|
||
import styles from "./Footer.module.css"; | ||
|
||
export const footerLinks = [ | ||
"Terms", | ||
"Privacy", | ||
"Help", | ||
"API", | ||
"Status", | ||
"Blog", | ||
]; | ||
|
||
export const Footer = (): JSX.Element => { | ||
const verticalOffset = useBreakpointValue({ sm: "", md: "6" }); | ||
const spacing = useBreakpointValue({ xs: 6, sm: 14 }); | ||
|
||
return ( | ||
<footer className={styles.footer}> | ||
<a | ||
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Hello{" "} | ||
</a> | ||
</footer> | ||
<Flex className={styles.footer}> | ||
<Center> | ||
<SimpleGrid columns={[1, 1, 2]}> | ||
<GridItem align="center" m="4"> | ||
<Heading size="sm" color="gray.500"> | ||
© 2020 White Van, Inc. | ||
</Heading> | ||
<Text fontSize="xs" color="white"> | ||
made with ❤ by pizza van | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we internationallize this + the footerLinks? |
||
</Text> | ||
</GridItem> | ||
<GridItem> | ||
<HStack pt={verticalOffset} spacing={spacing}> | ||
{footerLinks.map((link, index) => { | ||
return ( | ||
<Heading | ||
key={index} | ||
align="center" | ||
fontSize="sm" | ||
color="blue.600" | ||
> | ||
{link} | ||
</Heading> | ||
); | ||
})} | ||
</HStack> | ||
</GridItem> | ||
</SimpleGrid> | ||
</Center> | ||
</Flex> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,10 @@ import { render } from "@testing-library/react"; | |
import { axe, toHaveNoViolations } from "jest-axe"; | ||
import React from "react"; | ||
|
||
import { Footer } from "../../components/Footer"; | ||
import { Footer, footerLinks } from "../../components/Footer"; | ||
import { setupTests } from "../helpers"; | ||
|
||
setupTests(); | ||
|
||
describe("Footer", () => { | ||
expect.extend(toHaveNoViolations); | ||
|
@@ -15,6 +18,8 @@ describe("Footer", () => { | |
|
||
it("Basic render functionality", () => { | ||
const { queryByText } = render(<Footer />); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realized this a bit late but -- can we use |
||
expect(queryByText("Hello")).toBeInTheDocument(); | ||
footerLinks.forEach((link) => { | ||
expect(queryByText(link)).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Since this component is used outside of the main component, we need a semantic sectional HTML element wrapping it, rather than a div. Can we wrap this in a footer?
Reference: https://www.w3.org/TR/wai-aria-practices/examples/landmarks/HTML5.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, just read up on the ARIA practices and accessible considerations! Does your fix automatically do the
role="footer"
tag onto the footer as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't automatically add a role="footer", rather it's a replacement to it!
It's recommended to use semantic html elements over adding roles to ambigious elements.
I believe just having it as a footer html element should be sufficient considering we're only using it at the end of the page, (if we're using footers in a different context then we'd have to specific what role it is!)
If I remember correctly, the default role of a footer is contentinfo, so the role would be that I think