import React from 'react'
import styled from 'styled-components'
import {StaticQuery, graphql} from 'gatsby'
import {Flex} from 'rebass'
import {SidebarLink} from './links'
import Accordion from './Accordion'
const LinkDesc = styled.span`
font-size: 11px;
line-height: 1.5;
text-transform: lowercase;
display: block;
font-weight: 400;
color: ${(props) => props.theme.colors.darkGray};
`
const DocLinks = ({data}) => {
const linkInfo = data.allMarkdownRemark.nodes
const sections = ['cli-commands', 'configuring-npm', 'using-npm']
let sortedData = {}
sections.map((section) => (
sortedData[section] = linkInfo.filter(function (item) {
return item.frontmatter.section === section
})
))
return sections.map((section, index) => (
{sortedData[section].map((linkData, index) => {
const title = section === 'cli-commands'
? linkData.frontmatter.title.replace(/(npm-)+([a-zA-Z\\.-]*)/, 'npm $2')
: linkData.frontmatter.title
return (
{title}
{linkData.frontmatter.description}
)
})
}
))
}
export default props => (
}
/>
)