mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-01 15:55:34 +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 styles from './DocFooter.module.scss'
|
||||||
import { githubContentPath, githubDevOceanPath } from '../../config'
|
import { githubContentPath, githubDevOceanPath } from '../../config'
|
||||||
|
|
||||||
const DocFooter = ({ post }) => {
|
const DocFooter = ({ post, url, externalName }) => {
|
||||||
const { sourceInstanceName } = post.parent
|
|
||||||
|
|
||||||
let path
|
let path
|
||||||
let externalRepoName
|
|
||||||
|
|
||||||
switch (sourceInstanceName) {
|
if (post) {
|
||||||
case 'dev-ocean':
|
const { sourceInstanceName } = post.parent
|
||||||
path = githubDevOceanPath
|
|
||||||
externalRepoName = sourceInstanceName
|
switch (sourceInstanceName) {
|
||||||
break
|
case 'dev-ocean':
|
||||||
default:
|
path = githubDevOceanPath
|
||||||
path = githubContentPath
|
externalName = sourceInstanceName
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
path = githubContentPath
|
||||||
|
}
|
||||||
|
|
||||||
|
url = `${path}/${post.parent.relativePath}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className={styles.footer}>
|
<footer className={styles.footer}>
|
||||||
<a
|
<a href={url} className={post && !post.html ? styles.active : null}>
|
||||||
href={`${path}/${post.parent.relativePath}`}
|
|
||||||
className={!post.html ? styles.active : null}
|
|
||||||
>
|
|
||||||
<Pencil /> Edit this page on GitHub
|
<Pencil /> Edit this page on GitHub
|
||||||
{externalRepoName && (
|
{externalName && (
|
||||||
<span className={styles.externalRepoName}>
|
<span className={styles.externalRepoName}>
|
||||||
{externalRepoName}
|
{externalName}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
@ -37,7 +37,9 @@ const DocFooter = ({ post }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DocFooter.propTypes = {
|
DocFooter.propTypes = {
|
||||||
post: PropTypes.object.isRequired
|
post: PropTypes.object,
|
||||||
|
url: PropTypes.string,
|
||||||
|
externalName: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DocFooter
|
export default DocFooter
|
||||||
|
@ -8,6 +8,7 @@ import Content from '../components/Content'
|
|||||||
import HeaderSection from '../components/HeaderSection'
|
import HeaderSection from '../components/HeaderSection'
|
||||||
import Sidebar from '../components/Sidebar'
|
import Sidebar from '../components/Sidebar'
|
||||||
import DocHeader from '../components/DocHeader'
|
import DocHeader from '../components/DocHeader'
|
||||||
|
import DocFooter from '../components/DocFooter'
|
||||||
import SEO from '../components/Seo'
|
import SEO from '../components/Seo'
|
||||||
import stylesDoc from './Doc.module.scss'
|
import stylesDoc from './Doc.module.scss'
|
||||||
import styles from './ApiSwagger.module.scss'
|
import styles from './ApiSwagger.module.scss'
|
||||||
@ -275,6 +276,11 @@ export default class ApiSwaggerTemplate extends Component {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Paths paths={paths} />
|
<Paths paths={paths} />
|
||||||
|
|
||||||
|
<DocFooter
|
||||||
|
url={`https://github.com/oceanprotocol/${title.toLowerCase()}`}
|
||||||
|
externalName={`${title} Swagger spec`}
|
||||||
|
/>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
Reference in New Issue
Block a user