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',
|
||||
gitter: 'https://gitter.im/oceanprotocol/Lobby',
|
||||
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 { ReactComponent as Pencil } from '../images/pencil.svg'
|
||||
import styles from './DocFooter.module.scss'
|
||||
import { githubContentPath, githubDevOceanPath } from '../../config'
|
||||
|
||||
const githubContentPath =
|
||||
'https://github.com/oceanprotocol/docs/blob/master/content'
|
||||
const DocFooter = ({ post }) => {
|
||||
const { sourceInstanceName } = post.parent
|
||||
|
||||
const DocFooter = ({ post }) => (
|
||||
let path
|
||||
let externalRepoName
|
||||
|
||||
switch (sourceInstanceName) {
|
||||
case 'dev-ocean':
|
||||
path = githubDevOceanPath
|
||||
externalRepoName = sourceInstanceName
|
||||
break
|
||||
default:
|
||||
path = githubContentPath
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className={styles.footer}>
|
||||
<a
|
||||
href={`${githubContentPath}/${post.parent.relativePath}`}
|
||||
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 = {
|
||||
post: PropTypes.object.isRequired
|
||||
|
@ -30,3 +30,11 @@
|
||||
.active {
|
||||
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!) {
|
||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||
id
|
||||
excerpt
|
||||
tableOfContents
|
||||
html
|
||||
htmlAst
|
||||
fileAbsolutePath
|
||||
frontmatter {
|
||||
title
|
||||
description
|
||||
@ -131,6 +129,7 @@ export const pageQuery = graphql`
|
||||
parent {
|
||||
... on File {
|
||||
relativePath
|
||||
sourceInstanceName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user