1
0
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:
Matthias Kretschmann 2018-11-28 13:45:58 +01:00
parent a2252e10a5
commit 500206dd28
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 35 additions and 8 deletions

View File

@ -60,6 +60,7 @@
"rehype-react": "^3.1.0",
"remark": "^10.0.1",
"remark-react": "^5.0.0",
"slugify": "^1.3.3",
"swagger-client": "^3.8.22"
},
"devDependencies": {

View File

@ -95,9 +95,6 @@
li {
margin: 0;
}
a {
}
}
.active {

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { graphql } from 'gatsby'
import Helmet from 'react-helmet'
import slugify from 'slugify'
import Layout from '../components/Layout'
import Content from '../components/Content'
import HeaderSection from '../components/HeaderSection'
@ -9,13 +10,13 @@ import Sidebar from '../components/Sidebar'
import DocHeader from '../components/DocHeader'
import SEO from '../components/Seo'
import stylesDoc from './Doc.module.scss'
// import styles from './ApiSwagger.module.scss'
import styles from './ApiSwagger.module.scss'
const toc = api => {
const items = Object.keys(api.paths).map(
key =>
`<li key=${key}>
<a href="#${key.replace(/\//gi, '-')}"><code>${key}</code></a>
<a href="#${slugify(key)}"><code>${key}</code></a>
</li>`
)
@ -85,7 +86,8 @@ export default class ApiSwaggerTemplate extends Component {
<>
<h2
key={key}
id={key.replace(/\//gi, '-')}
id={slugify(key)}
className={styles.pathName}
>
<code>{key}</code>
</h2>
@ -93,12 +95,30 @@ export default class ApiSwaggerTemplate extends Component {
{Object.entries(value).map(
([key, value]) => (
<>
<h4 key={key}>
<h3
key={key}
className={
styles.pathMethod
}
>
<code>{key}</code>
</h4>
</h3>
<p>
{value['summary']}
</p>
{value[
'description'
] && (
<p>
{
value[
'description'
]
}
</p>
)}
</>
)
)}

View File

@ -0,0 +1,9 @@
@import 'variables';
.pathName {
font-size: $font-size-h2;
}
.pathMethod {
font-size: $font-size-h5;
}