This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
[DEV-027] Footer #46
Open
DigestedLime
wants to merge
2
commits into
develop
Choose a base branch
from
DEV-027
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[DEV-027] Footer #46
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -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> | ||
); | ||
}; |
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 |
---|---|---|
|
@@ -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(); | ||
}); | ||
}); | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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