Merge pull request #475 from wesbos/back-to-top

feat: add HTML-only back to top link
This commit is contained in:
Wes Bos 2020-01-22 11:24:39 -05:00 committed by GitHub
commit 9dab2205f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -21,7 +21,7 @@ function Header({ siteTitle, siteDescription, siteUrl }) {
<meta name="twitter:image" content={`${siteUrl}/twitter-card.png`} />
</Helmet>
<div>
<h1>
<h1 id="top">
<Link to="/">/uses</Link>
</h1>
<p>

View file

@ -7,6 +7,17 @@ import Layout from '../components/layout';
import Person from '../components/Person';
import Topics from '../components/Topics';
const BackToTopLink = styled.a`
position: fixed;
bottom: 1%;
right: 1%;
background: var(--pink);
cursor: pointer;
border-radius: 3px;
padding: 1rem;
transition: background-color 0.2s ease 0s;
`;
function IndexPage() {
const { currentTag } = useContext(FilterContext);
const { allPerson } = useStaticQuery(graphql`
@ -43,6 +54,7 @@ function IndexPage() {
<Person key={person.name} person={person} currentTag={currentTag} />
))}
</People>
<BackToTopLink href="#top">&uarr; Back to top</BackToTopLink>
</Layout>
);
}