Skip to content
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

move footer icons to CSS bg images #3655

Merged
merged 3 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions client/src/ui/organisms/footer/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,35 @@
ul {
padding-inline-start: $base-spacing / 4;
}
}

svg {
height: 18px;
vertical-align: sub;
width: 18px;
.social-icon::before {
background-size: 18px;
content: "";
display: inline-block;
filter: invert(1);
height: 18px;
vertical-align: sub;
width: 18px;
}

path {
fill: #fff;
}
}
.twitter::before {
background: transparent url("~@mdn/dinocons/social/twitter.svg") 0 0
no-repeat;
}

.github::before {
background: transparent url("~@mdn/dinocons/brands/github-mark-small.svg") 0
0 no-repeat;
}

.instagram::before {
background: transparent url("~@mdn/dinocons/social/instagram.svg") 0 0
no-repeat;
}

.visuall-hidden {
display: none;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe you will need to add this. The utility class should already be exposed by minimalist. On the relevant HTML element you should be able to add className="visually-hidden" and it should just work.


.footer-license {
Expand Down
21 changes: 8 additions & 13 deletions client/src/ui/organisms/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import * as React from "react";

import { ReactComponent as GithubIcon } from "@mdn/dinocons/brands/github-mark-small.svg";
import { ReactComponent as TwitterIcon } from "@mdn/dinocons/social/twitter.svg";
import { ReactComponent as InstagramIcon } from "@mdn/dinocons/social/instagram.svg";

import { useLocale } from "../../../hooks";
import { Logo } from "../../atoms/logo";
import "./index.scss";
Expand Down Expand Up @@ -76,22 +71,22 @@ export function Footer() {
<ul>
<li>
<a
className="social-icon twitter"
href="https://twitter.com/mozdevnet"
target="_blank"
rel="noopener noreferrer"
aria-label="Twitter"
>
<TwitterIcon />
<span className="visuall-hidden">MDN on Twitter</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? visually-hidden

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let me change it to Virtually. Btw let me know if other changes are needed as well :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, as Peter mentioned, you can use the existing visually-hidden class here and the other places later in the file.

</a>
</li>
<li>
<a
className="social-icon github"
href="https://github.com/mdn/"
target="_blank"
rel="noopener noreferrer"
aria-label="Github"
>
<GithubIcon />
<span className="visuall-hidden">MDN on Github</span>
</a>
</li>
</ul>
Expand All @@ -102,22 +97,22 @@ export function Footer() {
<ul>
<li>
<a
className="social-icon github"
href="https://twitter.com/mozilla"
target="_blank"
rel="noopener noreferrer"
aria-label="Twitter"
>
<TwitterIcon />
<span className="visuall-hidden">Mozilla on Twitter</span>
</a>
</li>
<li>
<a
className="social-icon instagram"
href="https://www.instagram.com/mozillagram/"
target="_blank"
rel="noopener noreferrer"
aria-label="Instagram"
>
<InstagramIcon />
<span className="visuall-hidden">Mozilla on Instagram</span>
</a>
</li>
</ul>
Expand Down