Skip to content

Commit

Permalink
Improve a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
willianjusten committed Apr 28, 2021
1 parent 83e13bd commit 9d4f68c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
9 changes: 2 additions & 7 deletions src/components/CartButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,10 @@ const CartButton = ({

return (
<Button
icon={
isInCart(id) ? (
<RemoveShoppingCart aria-label="Remove from cart" />
) : (
<AddShoppingCart aria-label="Add to cart" />
)
}
icon={isInCart(id) ? <RemoveShoppingCart /> : <AddShoppingCart />}
size={size}
onClick={() => (isInCart(id) ? removeFromCart(id) : addToCart(id))}
aria-label={ButtonText}
>
{hasText && ButtonText}
</Button>
Expand Down
12 changes: 7 additions & 5 deletions src/components/Footer/__snapshots__/test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ exports[`<Footer /> should render 4 column topics 1`] = `
.c3 a,
.c3 span {
display: block;
color: #8F8F8F;
color: #5c5c5c;
-webkit-text-decoration: none;
text-decoration: none;
margin-bottom: 0.8rem;
font-size: 1.4rem;
font-size: 1.6rem;
}
.c3 a {
Expand Down Expand Up @@ -180,6 +180,7 @@ exports[`<Footer /> should render 4 column topics 1`] = `
</a>
</div>
<div
aria-labelledby="social-media"
class="c3"
>
<h2
Expand All @@ -189,7 +190,7 @@ exports[`<Footer /> should render 4 column topics 1`] = `
Follow us
</h2>
<nav
aria-labelledby="social media"
id="social-media"
>
<a
href="https://www.instagram.com/won-games"
Expand Down Expand Up @@ -222,6 +223,7 @@ exports[`<Footer /> should render 4 column topics 1`] = `
</nav>
</div>
<div
aria-labelledby="resources"
class="c3"
>
<h2
Expand All @@ -231,7 +233,7 @@ exports[`<Footer /> should render 4 column topics 1`] = `
Links
</h2>
<nav
aria-labelledby="footer resources"
id="resources"
>
<a
href="/"
Expand All @@ -251,7 +253,7 @@ exports[`<Footer /> should render 4 column topics 1`] = `
</nav>
</div>
<div
aria-labelledby="footer-contact"
aria-label="contact"
class="c3"
>
<h2
Expand Down
10 changes: 5 additions & 5 deletions src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const Footer = () => (
<a href="mailto:sac@wongames.com">sac@wongames.com</a>
</S.Column>

<S.Column>
<S.Column aria-labelledby="social-media">
<Heading color="black" lineColor="secondary" lineBottom size="small">
Follow us
</Heading>

<nav aria-labelledby="social media">
<nav id="social-media">
<a
href="https://www.instagram.com/won-games"
target="_blank"
Expand Down Expand Up @@ -55,12 +55,12 @@ const Footer = () => (
</nav>
</S.Column>

<S.Column>
<S.Column aria-labelledby="resources">
<Heading color="black" lineColor="secondary" lineBottom size="small">
Links
</Heading>

<nav aria-labelledby="footer resources">
<nav id="resources">
<Link href="/">
<a>Home</a>
</Link>
Expand All @@ -73,7 +73,7 @@ const Footer = () => (
</nav>
</S.Column>

<S.Column aria-labelledby="footer-contact">
<S.Column aria-label="contact">
<Heading color="black" lineColor="secondary" lineBottom size="small">
Location
</Heading>
Expand Down
5 changes: 3 additions & 2 deletions src/components/Footer/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled, { css } from 'styled-components'
import media from 'styled-media-query'
import { darken } from 'polished'

import * as HeadingStyles from 'components/Heading/styles'

Expand Down Expand Up @@ -27,10 +28,10 @@ export const Column = styled.div`
a,
span {
display: block;
color: ${theme.colors.gray};
color: ${darken(0.2, theme.colors.gray)};
text-decoration: none;
margin-bottom: ${theme.spacings.xxsmall};
font-size: ${theme.font.sizes.small};
font-size: ${theme.font.sizes.medium};
}
a {
word-wrap: break-word;
Expand Down
2 changes: 1 addition & 1 deletion src/components/GameCard/__snapshots__/test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ exports[`<GameCard /> should render correctly 1`] = `
$235.00
</div>
<button
aria-label="Add to cart"
class="c11"
>
<svg
aria-hidden="true"
aria-label="Add to cart"
class="c8"
fill="currentColor"
focusable="false"
Expand Down
2 changes: 1 addition & 1 deletion src/components/GameInfo/__snapshots__/test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ exports[`<GameInfo /> should render game informations 1`] = `
class="c5"
>
<button
aria-label="Add to cart"
class="c6"
>
<svg
aria-hidden="true"
aria-label="Add to cart"
class="c7"
fill="currentColor"
focusable="false"
Expand Down

0 comments on commit 9d4f68c

Please sign in to comment.