mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
make edit link work for external repo contents
This commit is contained in:
parent
7c2eb987b1
commit
7de0d40f80
@ -14,5 +14,9 @@ module.exports = {
|
|||||||
twitter: 'https://twitter.com/oceanprotocol',
|
twitter: 'https://twitter.com/oceanprotocol',
|
||||||
gitter: 'https://gitter.im/oceanprotocol/Lobby',
|
gitter: 'https://gitter.im/oceanprotocol/Lobby',
|
||||||
telegram: 'https://t.me/joinchat/GUyxrE0Hi154D0NrlOqLFg'
|
telegram: 'https://t.me/joinchat/GUyxrE0Hi154D0NrlOqLFg'
|
||||||
}
|
},
|
||||||
|
githubContentPath:
|
||||||
|
'https://github.com/oceanprotocol/docs/blob/master/content',
|
||||||
|
githubDevOceanPath:
|
||||||
|
'https://github.com/oceanprotocol/dev-ocean/blob/master/doc'
|
||||||
}
|
}
|
||||||
|
2
external/dev-ocean
vendored
2
external/dev-ocean
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 491619c170b4d0bd3ab9bede26316ec6f80f4b84
|
Subproject commit 6bbf269da9eaf75c0fd42bd2a71944af52db6f04
|
@ -2,20 +2,39 @@ import React from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { ReactComponent as Pencil } from '../images/pencil.svg'
|
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'
|
||||||
|
|
||||||
const githubContentPath =
|
const DocFooter = ({ post }) => {
|
||||||
'https://github.com/oceanprotocol/docs/blob/master/content'
|
const { sourceInstanceName } = post.parent
|
||||||
|
|
||||||
const DocFooter = ({ post }) => (
|
let path
|
||||||
<footer className={styles.footer}>
|
let externalRepoName
|
||||||
<a
|
|
||||||
href={`${githubContentPath}/${post.parent.relativePath}`}
|
switch (sourceInstanceName) {
|
||||||
className={!post.html ? styles.active : null}
|
case 'dev-ocean':
|
||||||
>
|
path = githubDevOceanPath
|
||||||
<Pencil /> Edit this page on GitHub
|
externalRepoName = sourceInstanceName
|
||||||
</a>
|
break
|
||||||
</footer>
|
default:
|
||||||
)
|
path = githubContentPath
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<a
|
||||||
|
href={`${path}/${post.parent.relativePath}`}
|
||||||
|
className={!post.html ? styles.active : null}
|
||||||
|
>
|
||||||
|
<Pencil /> Edit this page on GitHub
|
||||||
|
{externalRepoName && (
|
||||||
|
<span className={styles.externalRepoName}>
|
||||||
|
{externalRepoName}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
DocFooter.propTypes = {
|
DocFooter.propTypes = {
|
||||||
post: PropTypes.object.isRequired
|
post: PropTypes.object.isRequired
|
||||||
|
@ -30,3 +30,11 @@
|
|||||||
.active {
|
.active {
|
||||||
color: $brand-pink !important; // stylelint-disable-line declaration-no-important
|
color: $brand-pink !important; // stylelint-disable-line declaration-no-important
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.externalRepoName {
|
||||||
|
font-family: $font-family-monospace;
|
||||||
|
font-weight: $font-weight-base;
|
||||||
|
font-size: $font-size-mini;
|
||||||
|
text-transform: none;
|
||||||
|
margin-left: $spacer / 4;
|
||||||
|
}
|
||||||
|
@ -101,11 +101,9 @@ export const pageQuery = graphql`
|
|||||||
query DocBySlug($slug: String!) {
|
query DocBySlug($slug: String!) {
|
||||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||||
id
|
id
|
||||||
excerpt
|
|
||||||
tableOfContents
|
tableOfContents
|
||||||
html
|
html
|
||||||
htmlAst
|
htmlAst
|
||||||
fileAbsolutePath
|
|
||||||
frontmatter {
|
frontmatter {
|
||||||
title
|
title
|
||||||
description
|
description
|
||||||
@ -131,6 +129,7 @@ export const pageQuery = graphql`
|
|||||||
parent {
|
parent {
|
||||||
... on File {
|
... on File {
|
||||||
relativePath
|
relativePath
|
||||||
|
sourceInstanceName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user