mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Feature: Render the generated docs in list
This commit is contained in:
parent
2b33152e18
commit
67c9968065
@ -26,7 +26,7 @@
|
|||||||
- group: ocean.py
|
- group: ocean.py
|
||||||
items:
|
items:
|
||||||
- title: API Reference
|
- title: API Reference
|
||||||
link: /read-the-docs/oceanpy/
|
link: /read-the-docs/ocean-py/
|
||||||
|
|
||||||
- group: Aquarius read the docs
|
- group: Aquarius read the docs
|
||||||
items:
|
items:
|
||||||
|
@ -65,9 +65,12 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
html
|
html
|
||||||
|
htmlAst
|
||||||
|
tableOfContents
|
||||||
frontmatter {
|
frontmatter {
|
||||||
slug
|
slug
|
||||||
title
|
title
|
||||||
|
section
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +160,7 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
let providerList = markdowns.filter(({node}) => node.frontmatter.slug.startsWith(prefix + '/provider/'))
|
let providerList = markdowns.filter(({node}) => node.frontmatter.slug.startsWith(prefix + '/provider/'))
|
||||||
|
|
||||||
|
|
||||||
await createReadTheDocsPage(createPage, 'oceanpy', oceanPyList)
|
await createReadTheDocsPage(createPage, 'ocean-py', oceanPyList)
|
||||||
await createReadTheDocsPage(createPage, 'aquarius', aquariusList)
|
await createReadTheDocsPage(createPage, 'aquarius', aquariusList)
|
||||||
await createReadTheDocsPage(createPage, 'provider', providerList)
|
await createReadTheDocsPage(createPage, 'provider', providerList)
|
||||||
|
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
import { Link } from "gatsby"
|
import { Link } from "gatsby"
|
||||||
import React from "react"
|
import React, {useState} from "react"
|
||||||
import Layout from "../components/Layout"
|
import Layout from "../components/Layout"
|
||||||
import HeaderSection from '../components/HeaderSection'
|
import HeaderSection from '../components/HeaderSection'
|
||||||
import Content from '../components/Content'
|
import Content from '../components/Content'
|
||||||
import styles from './Doc.module.scss'
|
import styles from '../templates/Doc.module.scss'
|
||||||
import MarkdownTemplate from "./MarkdownTemplate"
|
import MarkdownTemplate from './MarkdownTemplate'
|
||||||
|
import stylesDoc from '../templates/Doc.module.scss'
|
||||||
|
|
||||||
export default function MarkdownList({pageContext}) {
|
export default function MarkdownList({pageContext}) {
|
||||||
|
const [elem, setElem] = useState(0);
|
||||||
|
const changePage= (index)=>{
|
||||||
|
console.log("Onclickj")
|
||||||
|
setElem(index)
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<HeaderSection title={pageContext.name} />
|
<HeaderSection title={pageContext.name} />
|
||||||
@ -14,11 +20,14 @@ export default function MarkdownList({pageContext}) {
|
|||||||
<main className={styles.wrapper}>
|
<main className={styles.wrapper}>
|
||||||
<aside className={styles.sidebar}>
|
<aside className={styles.sidebar}>
|
||||||
<ul>
|
<ul>
|
||||||
{pageContext.markdownList.map(({node})=><li><Link to={node.frontmatter.slug}>{node.frontmatter.title}</Link></li>)}
|
{pageContext.markdownList.map(({node}, index)=><li onClick={()=>changePage(index)} key={node.id}>
|
||||||
|
{node.frontmatter.title}</li>)}
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
{/* <MarkdownTemplate path={pageContext.markdownList[0]}></MarkdownTemplate> */}
|
{/* <MarkdownTemplate path={pageContext.markdownList[0]}></MarkdownTemplate> */}
|
||||||
{/* {pageContext.markdownList[0]} */}
|
<article className={stylesDoc.main}>
|
||||||
|
<MarkdownTemplate data={pageContext.markdownList[elem].node}></MarkdownTemplate>
|
||||||
|
</article>
|
||||||
</main>
|
</main>
|
||||||
</Content>
|
</Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -8,41 +8,41 @@ import HeaderSection from '../components/HeaderSection'
|
|||||||
import Content from '../components/Content'
|
import Content from '../components/Content'
|
||||||
|
|
||||||
export default function MarkdownTemplate({data}) {
|
export default function MarkdownTemplate({data}) {
|
||||||
const post = data.markdownRemark
|
const post = data
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<>
|
||||||
{/* <div dangerouslySetInnerHTML={{__html:post.html}}></div> */}
|
{/* <div dangerouslySetInnerHTML={{__html:post.html}}></div> */}
|
||||||
{/* <DocHeader title={post.frontmatter.title}/> */}
|
{/* <DocHeader title={post.frontmatter.title}/> */}
|
||||||
<HeaderSection title={post.frontmatter.title} />
|
{/* <HeaderSection title={post.frontmatter.title} />
|
||||||
{post.tableOfContents && <DocToc tableOfContents={post.tableOfContents} />}
|
{post.tableOfContents && <DocToc tableOfContents={post.tableOfContents} />}*/}
|
||||||
<Content>
|
<Content>
|
||||||
<DocContent html={post.html} htmlAst={post.htmlAst} />
|
<DocContent html={post.html} htmlAst={post.htmlAst} />
|
||||||
</Content>
|
</Content>
|
||||||
</Layout>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const postQuery = graphql`
|
// export const postQuery = graphql`
|
||||||
query BlogPostByPath($path: String!) {
|
// query BlogPostByPath($path: String!) {
|
||||||
markdownRemark(frontmatter: { slug: { eq: $path } }) {
|
// markdownRemark(frontmatter: { slug: { eq: $path } }) {
|
||||||
html
|
// html
|
||||||
htmlAst
|
// htmlAst
|
||||||
tableOfContents(maxDepth: 2)
|
// tableOfContents
|
||||||
frontmatter {
|
// frontmatter {
|
||||||
slug
|
// slug
|
||||||
title
|
// title
|
||||||
section
|
// section
|
||||||
}
|
// }
|
||||||
...PageFooter
|
// ...PageFooter
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fragment PageFooter on MarkdownRemark {
|
// fragment PageFooter on MarkdownRemark {
|
||||||
parent {
|
// parent {
|
||||||
... on File {
|
// ... on File {
|
||||||
relativePath
|
// relativePath
|
||||||
sourceInstanceName
|
// sourceInstanceName
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
`
|
//`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user