From a55b2b87b797696547ca7a28623b7479db4253ce Mon Sep 17 00:00:00 2001 From: Zack Stickles Date: Fri, 24 Apr 2020 16:37:17 -0700 Subject: [PATCH] feat: recursively create sidebar navigation --- src/components/Sidebar.js | 21 +++++++++++++++-- src/pages/reference.js | 48 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index afe596456..f2433c421 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -1,14 +1,31 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { Link } from 'gatsby'; + +import { link } from '../types'; +// TODO: styles + +// TODO: aria + +// recursively create navigation +const renderNav = (page, index) => ( +
  • + {page.displayName} + {page.children && } +
  • +); const Sidebar = ({ pages }) => ( ); Sidebar.propTypes = { - pages: PropTypes.array, // TODO + pages: PropTypes.arrayOf(link), }; export default Sidebar; diff --git a/src/pages/reference.js b/src/pages/reference.js index dbc6d13f7..7a16e53ac 100644 --- a/src/pages/reference.js +++ b/src/pages/reference.js @@ -7,7 +7,53 @@ import Sidebar from '../components/Sidebar'; import '../templates/Reference.scss'; // TODO: pull this in from Gatsby -const pages = []; +const pages = [ + { displayName: 'Overview', url: '' }, + { + displayName: 'CLI', + url: '', + children: [ + { displayName: 'newrelic', url: '' }, + { displayName: 'nr1', url: '' }, + ], + }, + { displayName: 'GraphQL', url: '' }, + { + displayName: 'Applications', + url: '', + children: [ + { displayName: 'Component Library', url: '', active: true }, + { displayName: 'File structure', url: '' }, + ], + }, + { + displayName: 'Data Collectors', + url: '', + children: [ + { displayName: 'Custom Attributes', url: '' }, + { displayName: 'Custom Events', url: '' }, + { displayName: 'Open Telemetry', url: '' }, + { displayName: 'Telemetry SDK', url: '' }, + ], + }, + { + displayName: 'Automation', + url: '', + children: [ + { displayName: 'Cloud Formation Provider', url: '' }, + { displayName: 'Terraform Provider', url: '' }, + { + displayName: 'Agent Deploy', + url: '', + children: [ + { displayName: 'Ansible', url: '' }, + { displayName: 'Chef', url: '' }, + { displayName: 'Puppet', url: '' }, + ], + }, + ], + }, +]; const Reference = () => (