From 524ead7d1851a0c0868ff1b5bb2706aba2827526 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 27 Mar 2019 14:03:53 +0100 Subject: [PATCH] output params, returns, throws --- package.json | 22 ++++----- src/templates/Javadoc/index.jsx | 62 +++++++++++++++++++------ src/templates/Javadoc/index.module.scss | 23 +++++++++ 3 files changed, 81 insertions(+), 26 deletions(-) create mode 100644 src/templates/Javadoc/index.module.scss diff --git a/package.json b/package.json index acb545b4..91172d16 100644 --- a/package.json +++ b/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", diff --git a/src/templates/Javadoc/index.jsx b/src/templates/Javadoc/index.jsx index 7a35ccfd..7bb0e4c5 100644 --- a/src/templates/Javadoc/index.jsx +++ b/src/templates/Javadoc/index.jsx @@ -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 && ( +

{title}

+ )} + + {item + .filter(item => item.name === name) + .map((item, index) => ( +
+ {item.text} +
+ ))} + + ) +} + +const Entities = ({ javadoc }) => { return Object.entries(javadoc).map(([key, value]) => (
{ {cleanPaths(key)} - {value[0][0].text} +

{value[0][0].text}

-

Parameters

+ {value.map((item, index) => { + if (index === 0) return - {/* - {value - .filter(item => { - return item.name === '@param' - }) - .map(item => { - return item.text - })} - */} + return ( +
+

Function Name

-

Returns

+

{item[0].text}

-

Throws

+ {filterPropertyItems(item, '@param')} + {filterPropertyItems(item, '@return')} + {filterPropertyItems(item, '@throws')} +
+ ) + })}
)) } @@ -104,7 +136,7 @@ export default class JavadocTemplate extends Component { } /> - + diff --git a/src/templates/Javadoc/index.module.scss b/src/templates/Javadoc/index.module.scss new file mode 100644 index 00000000..03c9cfc0 --- /dev/null +++ b/src/templates/Javadoc/index.module.scss @@ -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; +}