forked from gatsbyjs/gatsby-starter-blog
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gatsby-plugin-react-svg & enhance Footer
`npm i --save gatsby-plugin-react-svg`
- Loading branch information
1 parent
34e3ee2
commit 26b3985
Showing
7 changed files
with
208 additions
and
25 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from "react" | ||
import { useStaticQuery, graphql } from "gatsby" | ||
import styled from "styled-components" | ||
import TwitterLogo from "../../content/assets/social-media-icons/twitter.inline.svg" | ||
|
||
const StyledFooter = styled.footer` | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); | ||
grid-column-gap: 1.2rem; | ||
grid-row-gap: 0.5rem; | ||
font-size: 0.8em; | ||
div { | ||
display: flex; | ||
> * { | ||
margin: auto; | ||
box-shadow: none; | ||
} | ||
svg { | ||
display: block; | ||
fill: currentColor; | ||
transition: 1.2s; | ||
} | ||
a:hover svg { | ||
fill: black; | ||
transition: 1.2s; | ||
} | ||
} | ||
` | ||
const Footer = ({ className }) => { | ||
const data = useStaticQuery(graphql` | ||
query LayoutQuery { | ||
site { | ||
siteMetadata { | ||
social { | ||
} | ||
} | ||
} | ||
} | ||
`) | ||
const twitter = data.site.siteMetadata.social.twitter | ||
|
||
return ( | ||
<StyledFooter className={className}> | ||
<div> | ||
<a | ||
href={`https://twitter.com/${twitter}`} | ||
aria-label={`Follow ${twitter} on Twitter`} | ||
> | ||
<TwitterLogo width="36" height="36" /> | ||
</a> | ||
</div> | ||
<div> | ||
<p>Copyright © {new Date().getFullYear()} </p> | ||
</div> | ||
</StyledFooter> | ||
) | ||
} | ||
|
||
|
||
export default Footer |
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