Created
January 5, 2020 12:21
-
-
Save siisee11/8df0836f3b74d19f4e81033525b2a0f9 to your computer and use it in GitHub Desktop.
graphql
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
import React from "react" | |
import { useStaticQuery, Link, graphql } from "gatsby" | |
const ListLink = props => ( | |
<li style={{ display: `inline-block`, marginRight: `1rem` }}> | |
<Link to={props.to}>{props.children}</Link> | |
</li> | |
) | |
export default ({ children }) => { | |
const data = useStaticQuery( | |
graphql` | |
query { | |
site { | |
siteMetadata { | |
title | |
} | |
} | |
} | |
` | |
) | |
return ( | |
<div style={{ margin: `3rem auto`, maxWidth: 650, padding: `0 1rem` }}> | |
<header style={{ marginBottom: `1.5rem` }}> | |
<Link to="/" style={{ textShadow: `none`, backgroundImage: `none` }}> | |
<h3 style={{ display: `inline` }}>{data.site.siteMetadata.title}</h3> | |
</Link> | |
<ul style={{ listStyle: `none`, float: `right` }}> | |
<ListLink to="/">Home</ListLink> | |
<ListLink to="/about/">About</ListLink> | |
<ListLink to="/contact/">Contact</ListLink> | |
</ul> | |
</header> | |
{children} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment