Commit 6113a595 authored by alain's avatar alain 🐙
Browse files

make header dynamic

parent 360619f0
import { Link } from "gatsby"
import { Link, StaticQuery, graphql } from "gatsby"
import PropTypes from "prop-types"
import React from "react"
const Header = ({ siteTitle }) => (
<header >
<h1>
<Link to="/">{ siteTitle }</Link>
</h1>
<ul>
<li><Link to="/" >The Public Stack</Link></li>
<li><Link to="/domains" >Domains</Link></li>
<li><Link to="/use-cases" >Use Cases</Link></li>
</ul>
<nav className="menu-container">
<input type="checkbox" aria-label="Toggle menu" />
<span></span>
<span></span>
<span></span>
<h1 className="menu-logo"><Link to="/" >{ siteTitle }</Link></h1>
<ul className="menu">
<StaticQuery query={graphql`
query MenuQuery {
allStrapiMenuItem {
nodes {
id
title,
subtitle,
link,
type
}
}
}
`}
render={data => data.allStrapiMenuItem.nodes.map(item => <li key={item.id} className={item.type}><Link to={item.link}>{item.title}</Link></li>)}
/>
</ul>
</nav>
</header>
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment