import React, { Component } from 'react' import PropTypes from 'prop-types' import { Link } from 'gatsby' import styles from './Sidebar.module.scss' const SidebarLink = ({ link, title, linkClasses }) => { if (link) { if (link.match(/^\s?http(s?)/gi)) { return ( {title} ) } else { return ( {title} ) } } else { return title } } const SidebarList = ({ items, location }) => ( ) export default class Sidebar extends Component { static propTypes = { sidebar: PropTypes.string, location: PropTypes.object.isRequired, toc: PropTypes.bool, tableOfContents: PropTypes.string } static defaultProps = { location: { pathname: `/` } } render() { const { sidebar, location, toc, tableOfContents } = this.props const sidebarfile = sidebar ? require(`../../data/sidebars/${sidebar}.yml`) : [] // eslint-disable-line if (!sidebarfile) { return null } return ( ) } } SidebarLink.propTypes = { link: PropTypes.string.isRequired, title: PropTypes.string.isRequired, linkClasses: PropTypes.string } SidebarList.propTypes = { items: PropTypes.array.isRequired, location: PropTypes.object.isRequired }