mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
more data, start styling, con sistent link slugs, fix build
This commit is contained in:
parent
a2252e10a5
commit
500206dd28
@ -60,6 +60,7 @@
|
|||||||
"rehype-react": "^3.1.0",
|
"rehype-react": "^3.1.0",
|
||||||
"remark": "^10.0.1",
|
"remark": "^10.0.1",
|
||||||
"remark-react": "^5.0.0",
|
"remark-react": "^5.0.0",
|
||||||
|
"slugify": "^1.3.3",
|
||||||
"swagger-client": "^3.8.22"
|
"swagger-client": "^3.8.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -95,9 +95,6 @@
|
|||||||
li {
|
li {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.active {
|
.active {
|
||||||
|
@ -2,6 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { graphql } from 'gatsby'
|
import { graphql } from 'gatsby'
|
||||||
import Helmet from 'react-helmet'
|
import Helmet from 'react-helmet'
|
||||||
|
import slugify from 'slugify'
|
||||||
import Layout from '../components/Layout'
|
import Layout from '../components/Layout'
|
||||||
import Content from '../components/Content'
|
import Content from '../components/Content'
|
||||||
import HeaderSection from '../components/HeaderSection'
|
import HeaderSection from '../components/HeaderSection'
|
||||||
@ -9,13 +10,13 @@ import Sidebar from '../components/Sidebar'
|
|||||||
import DocHeader from '../components/DocHeader'
|
import DocHeader from '../components/DocHeader'
|
||||||
import SEO from '../components/Seo'
|
import SEO from '../components/Seo'
|
||||||
import stylesDoc from './Doc.module.scss'
|
import stylesDoc from './Doc.module.scss'
|
||||||
// import styles from './ApiSwagger.module.scss'
|
import styles from './ApiSwagger.module.scss'
|
||||||
|
|
||||||
const toc = api => {
|
const toc = api => {
|
||||||
const items = Object.keys(api.paths).map(
|
const items = Object.keys(api.paths).map(
|
||||||
key =>
|
key =>
|
||||||
`<li key=${key}>
|
`<li key=${key}>
|
||||||
<a href="#${key.replace(/\//gi, '-')}"><code>${key}</code></a>
|
<a href="#${slugify(key)}"><code>${key}</code></a>
|
||||||
</li>`
|
</li>`
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -85,7 +86,8 @@ export default class ApiSwaggerTemplate extends Component {
|
|||||||
<>
|
<>
|
||||||
<h2
|
<h2
|
||||||
key={key}
|
key={key}
|
||||||
id={key.replace(/\//gi, '-')}
|
id={slugify(key)}
|
||||||
|
className={styles.pathName}
|
||||||
>
|
>
|
||||||
<code>{key}</code>
|
<code>{key}</code>
|
||||||
</h2>
|
</h2>
|
||||||
@ -93,12 +95,30 @@ export default class ApiSwaggerTemplate extends Component {
|
|||||||
{Object.entries(value).map(
|
{Object.entries(value).map(
|
||||||
([key, value]) => (
|
([key, value]) => (
|
||||||
<>
|
<>
|
||||||
<h4 key={key}>
|
<h3
|
||||||
|
key={key}
|
||||||
|
className={
|
||||||
|
styles.pathMethod
|
||||||
|
}
|
||||||
|
>
|
||||||
<code>{key}</code>
|
<code>{key}</code>
|
||||||
</h4>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{value['summary']}
|
{value['summary']}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{value[
|
||||||
|
'description'
|
||||||
|
] && (
|
||||||
|
<p>
|
||||||
|
{
|
||||||
|
value[
|
||||||
|
'description'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
@import 'variables';
|
||||||
|
|
||||||
|
.pathName {
|
||||||
|
font-size: $font-size-h2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pathMethod {
|
||||||
|
font-size: $font-size-h5;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user