Skip to content

Commit

Permalink
feat: populate side nav from json file
Browse files Browse the repository at this point in the history
  • Loading branch information
timglaser committed May 18, 2020
1 parent 35d320e commit 447e68c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
7 changes: 7 additions & 0 deletions src/data/sidenav.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"displayName": "Guides",
"url": "/guides",
"children": []
}
]
21 changes: 2 additions & 19 deletions src/pages/reference.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
import React, { useState } from 'react';
import { useStaticQuery, graphql } from 'gatsby';

import Container from '../components/Container';
import Layout from '../components/Layout';
import Sidebar from '../components/Sidebar';
import navFromEdges from '../utils/nav-from-edges';

import pages from '../data/sidenav.json';

// TODO: move this js file to same directory and update import
import '../templates/Reference.scss';

const Reference = () => {
const [isOpen, setIsOpen] = useState(false);

const data = useStaticQuery(graphql`
query {
allMarkdownRemark(limit: 1000) {
edges {
node {
frontmatter {
path
title
}
}
}
}
}
`);
const pages = navFromEdges(data.allMarkdownRemark.edges);

return (
<Layout>
<Container className="ReferenceTemplate">
Expand Down

0 comments on commit 447e68c

Please sign in to comment.