mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
basic setup for squid-java
This commit is contained in:
parent
7dc037aaa6
commit
f28289c301
3060
data/squid-java.json
Normal file
3060
data/squid-java.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -249,6 +249,34 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create pages from Javadoc json files
|
||||||
|
//
|
||||||
|
const javadocSpecs = ['./data/squid-java.json']
|
||||||
|
const javadocTemplate = path.resolve(
|
||||||
|
'./src/templates/Javadoc/index.jsx'
|
||||||
|
)
|
||||||
|
|
||||||
|
javadocSpecs.forEach(spec => {
|
||||||
|
const javadoc = require(spec) // eslint-disable-line
|
||||||
|
|
||||||
|
const name = path
|
||||||
|
.basename(spec)
|
||||||
|
.split('.json')
|
||||||
|
.join('')
|
||||||
|
|
||||||
|
const slug = `/references/${name}/`
|
||||||
|
|
||||||
|
createPage({
|
||||||
|
path: slug,
|
||||||
|
component: javadocTemplate,
|
||||||
|
context: {
|
||||||
|
slug,
|
||||||
|
javadoc
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
//
|
//
|
||||||
// create redirects
|
// create redirects
|
||||||
//
|
//
|
||||||
|
@ -54,3 +54,11 @@
|
|||||||
font-family: $font-family-monospace;
|
font-family: $font-family-monospace;
|
||||||
color: $brand-grey-light;
|
color: $brand-grey-light;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pathName {
|
||||||
|
font-size: $font-size-h3;
|
||||||
|
border-bottom: 1px solid $brand-grey-lighter;
|
||||||
|
padding-bottom: $spacer / 2;
|
||||||
|
margin-top: $spacer * 2;
|
||||||
|
margin-bottom: $spacer;
|
||||||
|
}
|
||||||
|
108
src/templates/Javadoc/index.jsx
Normal file
108
src/templates/Javadoc/index.jsx
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import React, { Component } from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import { graphql } from 'gatsby'
|
||||||
|
import Helmet from 'react-helmet'
|
||||||
|
import Layout from '../../components/Layout'
|
||||||
|
import Content from '../../components/Content'
|
||||||
|
import HeaderSection from '../../components/HeaderSection'
|
||||||
|
import Sidebar from '../../components/Sidebar'
|
||||||
|
import DocHeader from '../../components/DocHeader'
|
||||||
|
import SEO from '../../components/Seo'
|
||||||
|
import stylesDoc from '../Doc.module.scss'
|
||||||
|
|
||||||
|
const title = 'squid-java'
|
||||||
|
const description = 'Java client library for Ocean Protocol'
|
||||||
|
const version = '0.2.0'
|
||||||
|
|
||||||
|
const cleanPaths = path =>
|
||||||
|
path.replace('src/main/java/com/oceanprotocol/squid/', '')
|
||||||
|
|
||||||
|
const Paths = ({ javadoc }) => {
|
||||||
|
return Object.keys(javadoc).map(path => (
|
||||||
|
<div key={path}>
|
||||||
|
<h2 className={stylesDoc.pathName}>
|
||||||
|
<code>{cleanPaths(path)}</code>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class JavadocTemplate extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
data: PropTypes.object.isRequired,
|
||||||
|
location: PropTypes.object.isRequired,
|
||||||
|
pageContext: PropTypes.object.isRequired
|
||||||
|
}
|
||||||
|
|
||||||
|
// output section title as defined in sections.yml
|
||||||
|
sectionTitle = this.props.data.allSectionsYaml.edges.map(({ node }) => {
|
||||||
|
// compare section against section title from sections.yml
|
||||||
|
if (node.title.toLowerCase().includes('references')) {
|
||||||
|
return node.title
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { location, pageContext } = this.props
|
||||||
|
const { javadoc } = pageContext
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Helmet>
|
||||||
|
<body className={'references'} />
|
||||||
|
</Helmet>
|
||||||
|
|
||||||
|
<SEO
|
||||||
|
title={title}
|
||||||
|
description={description}
|
||||||
|
slug={pageContext.slug}
|
||||||
|
article
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Layout location={location}>
|
||||||
|
<HeaderSection title={this.sectionTitle} />
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<main className={stylesDoc.wrapper}>
|
||||||
|
<aside className={stylesDoc.sidebar}>
|
||||||
|
<Sidebar
|
||||||
|
location={location}
|
||||||
|
sidebar={'references'}
|
||||||
|
collapsed
|
||||||
|
toc
|
||||||
|
/>
|
||||||
|
</aside>
|
||||||
|
<article className={stylesDoc.main}>
|
||||||
|
<DocHeader
|
||||||
|
title={title}
|
||||||
|
description={description}
|
||||||
|
prepend={
|
||||||
|
<span className={stylesDoc.version}>
|
||||||
|
{version}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Paths javadoc={javadoc} />
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
</Content>
|
||||||
|
</Layout>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const JavadocQuery = graphql`
|
||||||
|
query {
|
||||||
|
allSectionsYaml {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
link
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
|
|||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
import { cleanPathKey } from './utils'
|
import { cleanPathKey } from './utils'
|
||||||
import styles from './Paths.module.scss'
|
import styles from './Paths.module.scss'
|
||||||
|
import stylesDoc from '../Doc.module.scss'
|
||||||
|
|
||||||
const ParameterExample = ({ properties }) => (
|
const ParameterExample = ({ properties }) => (
|
||||||
//
|
//
|
||||||
@ -146,7 +147,7 @@ Method.propTypes = {
|
|||||||
const Paths = ({ paths }) =>
|
const Paths = ({ paths }) =>
|
||||||
Object.entries(paths).map(([key, value]) => (
|
Object.entries(paths).map(([key, value]) => (
|
||||||
<div key={key} id={slugify(cleanPathKey(key))}>
|
<div key={key} id={slugify(cleanPathKey(key))}>
|
||||||
<h2 className={styles.pathName}>
|
<h2 className={stylesDoc.pathName}>
|
||||||
<code>{cleanPathKey(key)}</code>
|
<code>{cleanPathKey(key)}</code>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
|
||||||
.pathName {
|
|
||||||
font-size: $font-size-h3;
|
|
||||||
border-bottom: 1px solid $brand-grey-lighter;
|
|
||||||
padding-bottom: $spacer / 2;
|
|
||||||
margin-top: $spacer * 2;
|
|
||||||
margin-bottom: $spacer;
|
|
||||||
|
|
||||||
code {
|
|
||||||
// stylelint-disable-next-line
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.pathMethod {
|
.pathMethod {
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
font-family: $font-family-monospace;
|
font-family: $font-family-monospace;
|
||||||
|
@ -1,18 +1,8 @@
|
|||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
|
||||||
.entityName {
|
.entityName {
|
||||||
|
composes: pathName from '../Doc.module.scss';
|
||||||
font-size: $font-size-h2;
|
font-size: $font-size-h2;
|
||||||
border-bottom: 1px solid $brand-grey-lighter;
|
|
||||||
padding-bottom: $spacer / 2;
|
|
||||||
margin-top: $spacer * 2;
|
|
||||||
margin-bottom: $spacer;
|
|
||||||
|
|
||||||
code {
|
|
||||||
// stylelint-disable declaration-no-important
|
|
||||||
background: none !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
// stylelint-enable declaration-no-important
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.entityDescription {
|
.entityDescription {
|
||||||
|
Loading…
Reference in New Issue
Block a user