mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-02 08:20:22 +01:00
output params, returns, throws
This commit is contained in:
parent
34fb7be091
commit
524ead7d18
22
package.json
22
package.json
@ -26,15 +26,15 @@
|
||||
"@oceanprotocol/art": "^2.2.0",
|
||||
"axios": "^0.18.0",
|
||||
"classnames": "^2.2.6",
|
||||
"gatsby": "^2.2.8",
|
||||
"gatsby-image": "^2.0.34",
|
||||
"gatsby": "^2.3.2",
|
||||
"gatsby-image": "^2.0.35",
|
||||
"gatsby-plugin-catch-links": "^2.0.13",
|
||||
"gatsby-plugin-google-analytics": "^2.0.17",
|
||||
"gatsby-plugin-google-analytics": "^2.0.18",
|
||||
"gatsby-plugin-manifest": "^2.0.24",
|
||||
"gatsby-plugin-offline": "^2.0.25",
|
||||
"gatsby-plugin-react-helmet": "^3.0.10",
|
||||
"gatsby-plugin-react-helmet": "^3.0.11",
|
||||
"gatsby-plugin-sass": "^2.0.11",
|
||||
"gatsby-plugin-sharp": "^2.0.30",
|
||||
"gatsby-plugin-sharp": "^2.0.31",
|
||||
"gatsby-plugin-sitemap": "^2.0.10",
|
||||
"gatsby-plugin-svgr": "^2.0.2",
|
||||
"gatsby-remark-autolink-headers": "^2.0.16",
|
||||
@ -51,13 +51,13 @@
|
||||
"gatsby-transformer-remark": "^2.3.8",
|
||||
"gatsby-transformer-sharp": "^2.1.17",
|
||||
"gatsby-transformer-xml": "^2.0.9",
|
||||
"gatsby-transformer-yaml": "^2.1.10",
|
||||
"gatsby-transformer-yaml": "^2.1.11",
|
||||
"giphy-js-sdk-core": "^1.0.6",
|
||||
"intersection-observer": "^0.5.1",
|
||||
"node-sass": "^4.11.0",
|
||||
"prismjs": "^1.15.0",
|
||||
"react": "^16.8.4",
|
||||
"react-dom": "^16.8.4",
|
||||
"prismjs": "^1.16.0",
|
||||
"react": "^16.8.5",
|
||||
"react-dom": "^16.8.5",
|
||||
"react-helmet": "^5.2.0",
|
||||
"react-scrollspy": "^3.4.0",
|
||||
"rehype-react": "^3.1.0",
|
||||
@ -65,7 +65,7 @@
|
||||
"remark-github-plugin": "^1.3.1",
|
||||
"remark-react": "^5.0.1",
|
||||
"slugify": "^1.3.4",
|
||||
"smoothscroll-polyfill": "^0.4.3",
|
||||
"smoothscroll-polyfill": "^0.4.4",
|
||||
"swagger-client": "^3.8.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -75,7 +75,7 @@
|
||||
"eslint-config-oceanprotocol": "^1.3.0",
|
||||
"eslint-config-prettier": "^4.1.0",
|
||||
"eslint-plugin-prettier": "^3.0.1",
|
||||
"markdownlint-cli": "^0.14.0",
|
||||
"markdownlint-cli": "^0.14.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"ora": "^3.2.0",
|
||||
"prettier": "^1.16.4",
|
||||
|
@ -10,11 +10,43 @@ import Sidebar from '../../components/Sidebar'
|
||||
import DocHeader from '../../components/DocHeader'
|
||||
import SEO from '../../components/Seo'
|
||||
import stylesDoc from '../Doc.module.scss'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
import Toc from './Toc'
|
||||
import { cleanPaths } from './utils'
|
||||
|
||||
const Paths = ({ javadoc }) => {
|
||||
const filterPropertyItems = (item, name) => {
|
||||
let title
|
||||
switch (name) {
|
||||
case '@param':
|
||||
title = 'Parameters'
|
||||
break
|
||||
case '@return':
|
||||
title = 'Returns'
|
||||
break
|
||||
case '@throws':
|
||||
title = 'Throws'
|
||||
break
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{item.filter(item => item.name === name).length > 0 && (
|
||||
<h4 className={styles.subHeading}>{title}</h4>
|
||||
)}
|
||||
|
||||
{item
|
||||
.filter(item => item.name === name)
|
||||
.map((item, index) => (
|
||||
<div key={index}>
|
||||
<code>{item.text}</code>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const Entities = ({ javadoc }) => {
|
||||
return Object.entries(javadoc).map(([key, value]) => (
|
||||
<div
|
||||
key={key}
|
||||
@ -26,23 +58,23 @@ const Paths = ({ javadoc }) => {
|
||||
<code>{cleanPaths(key)}</code>
|
||||
</h2>
|
||||
|
||||
{value[0][0].text}
|
||||
<p>{value[0][0].text}</p>
|
||||
|
||||
<h4>Parameters</h4>
|
||||
{value.map((item, index) => {
|
||||
if (index === 0) return
|
||||
|
||||
{/*
|
||||
{value
|
||||
.filter(item => {
|
||||
return item.name === '@param'
|
||||
})
|
||||
.map(item => {
|
||||
return item.text
|
||||
})}
|
||||
*/}
|
||||
return (
|
||||
<div key={index} className={styles.property}>
|
||||
<h3 className={styles.propertyName}>Function Name</h3>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<p>{item[0].text}</p>
|
||||
|
||||
<h4>Throws</h4>
|
||||
{filterPropertyItems(item, '@param')}
|
||||
{filterPropertyItems(item, '@return')}
|
||||
{filterPropertyItems(item, '@throws')}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
))
|
||||
}
|
||||
@ -104,7 +136,7 @@ export default class JavadocTemplate extends Component {
|
||||
}
|
||||
/>
|
||||
|
||||
<Paths javadoc={javadoc} />
|
||||
<Entities javadoc={javadoc} />
|
||||
</article>
|
||||
</main>
|
||||
</Content>
|
||||
|
23
src/templates/Javadoc/index.module.scss
Normal file
23
src/templates/Javadoc/index.module.scss
Normal file
@ -0,0 +1,23 @@
|
||||
@import 'variables';
|
||||
|
||||
.property {
|
||||
padding: $spacer / 2;
|
||||
border: 1px solid $brand-grey-lighter;
|
||||
margin-bottom: $spacer;
|
||||
border-radius: $border-radius;
|
||||
}
|
||||
|
||||
.subHeading {
|
||||
font-size: $font-size-base;
|
||||
border-bottom: 1px solid $brand-grey-lighter;
|
||||
padding-bottom: $spacer / 4;
|
||||
margin-bottom: $spacer / 4;
|
||||
color: $brand-grey;
|
||||
}
|
||||
|
||||
.propertyName {
|
||||
font-size: $font-size-large;
|
||||
font-family: $font-family-monospace;
|
||||
margin-bottom: $spacer / 2;
|
||||
margin-top: 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user