mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
make DocFooter more flexible, add to swagger template
This commit is contained in:
parent
ba5f6bab1d
commit
fe5902e5b1
@ -4,31 +4,31 @@ import { ReactComponent as Pencil } from '../images/pencil.svg'
|
||||
import styles from './DocFooter.module.scss'
|
||||
import { githubContentPath, githubDevOceanPath } from '../../config'
|
||||
|
||||
const DocFooter = ({ post }) => {
|
||||
const { sourceInstanceName } = post.parent
|
||||
|
||||
const DocFooter = ({ post, url, externalName }) => {
|
||||
let path
|
||||
let externalRepoName
|
||||
|
||||
switch (sourceInstanceName) {
|
||||
case 'dev-ocean':
|
||||
path = githubDevOceanPath
|
||||
externalRepoName = sourceInstanceName
|
||||
break
|
||||
default:
|
||||
path = githubContentPath
|
||||
if (post) {
|
||||
const { sourceInstanceName } = post.parent
|
||||
|
||||
switch (sourceInstanceName) {
|
||||
case 'dev-ocean':
|
||||
path = githubDevOceanPath
|
||||
externalName = sourceInstanceName
|
||||
break
|
||||
default:
|
||||
path = githubContentPath
|
||||
}
|
||||
|
||||
url = `${path}/${post.parent.relativePath}`
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className={styles.footer}>
|
||||
<a
|
||||
href={`${path}/${post.parent.relativePath}`}
|
||||
className={!post.html ? styles.active : null}
|
||||
>
|
||||
<a href={url} className={post && !post.html ? styles.active : null}>
|
||||
<Pencil /> Edit this page on GitHub
|
||||
{externalRepoName && (
|
||||
{externalName && (
|
||||
<span className={styles.externalRepoName}>
|
||||
{externalRepoName}
|
||||
{externalName}
|
||||
</span>
|
||||
)}
|
||||
</a>
|
||||
@ -37,7 +37,9 @@ const DocFooter = ({ post }) => {
|
||||
}
|
||||
|
||||
DocFooter.propTypes = {
|
||||
post: PropTypes.object.isRequired
|
||||
post: PropTypes.object,
|
||||
url: PropTypes.string,
|
||||
externalName: PropTypes.string
|
||||
}
|
||||
|
||||
export default DocFooter
|
||||
|
@ -8,6 +8,7 @@ import Content from '../components/Content'
|
||||
import HeaderSection from '../components/HeaderSection'
|
||||
import Sidebar from '../components/Sidebar'
|
||||
import DocHeader from '../components/DocHeader'
|
||||
import DocFooter from '../components/DocFooter'
|
||||
import SEO from '../components/Seo'
|
||||
import stylesDoc from './Doc.module.scss'
|
||||
import styles from './ApiSwagger.module.scss'
|
||||
@ -275,6 +276,11 @@ export default class ApiSwaggerTemplate extends Component {
|
||||
)}
|
||||
|
||||
<Paths paths={paths} />
|
||||
|
||||
<DocFooter
|
||||
url={`https://github.com/oceanprotocol/${title.toLowerCase()}`}
|
||||
externalName={`${title} Swagger spec`}
|
||||
/>
|
||||
</article>
|
||||
</main>
|
||||
</Content>
|
||||
|
Loading…
Reference in New Issue
Block a user