Created
June 18, 2020 16:45
-
-
Save jamiejohnsonkc/68cd9b4f0ddcc3b7be182d4e6d28648f to your computer and use it in GitHub Desktop.
This file contains hidden or 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, { Component } from "react" | |
| import MyLink3 from "./MyLink3" | |
| import { StaticQuery, graphql } from "gatsby" | |
| const LinkList3 = () => { | |
| return ( | |
| <StaticQuery | |
| query={graphql` | |
| query { | |
| site { | |
| siteMetadata { | |
| title | |
| menuLinks { | |
| name | |
| link | |
| subMenu { | |
| link | |
| name | |
| } | |
| } | |
| } | |
| } | |
| } | |
| `} | |
| render={(data) => ( | |
| <ul> | |
| {data.site.siteMetadata.menuLinks.map((link) => ( | |
| <li key={link.name} link={link}> | |
| {link.name} | |
| {link.subMenu && link.subMenu.length > 0 ? ( | |
| <ul aria-label="submenu"> | |
| {link.subMenu.map((subLink) => ( | |
| <li key={subLink.name}> | |
| <a href={subLink.link}>{subLink.name}</a> | |
| </li> | |
| ))} | |
| </ul> | |
| ) : null} | |
| </li> | |
| ))} | |
| </ul> | |
| )} | |
| /> | |
| ) | |
| } | |
| export default LinkList3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment