Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/DocFooter.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import PropTypes from 'prop-types'
import { ReactComponent as Pencil } from '../images/pencil.svg'
import styles from './DocFooter.module.scss'

const githubContentPath =
'https://github.com/oceanprotocol/docs/blob/master/content'

const DocFooter = ({ post }) => (
<footer className={styles.footer}>
<a href={`${githubContentPath}/${post.parent.relativePath}`}>
<Pencil /> Edit this page on GitHub
</a>
</footer>
)

DocFooter.propTypes = {
post: PropTypes.object.isRequired
}

export default DocFooter
30 changes: 30 additions & 0 deletions src/components/DocFooter.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@import 'variables';

.footer {
margin-top: $spacer;
padding-top: $spacer;
margin-bottom: $spacer;
padding-bottom: $spacer;
border-top: .1rem solid $brand-grey-lighter;
font-size: $font-size-small;
text-align: center;

a {
font-family: $font-family-button;
text-transform: uppercase;
color: $brand-grey-light;
margin: 0 $spacer / 2;

&:hover,
&:focus {
color: $brand-pink;
}

svg {
display: inline-block;
margin-right: $spacer / 10;
margin-bottom: -1px;
fill: $brand-grey-light;
}
}
}
3 changes: 3 additions & 0 deletions src/images/pencil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/templates/Doc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Layout from '../components/Layout'
import Content from '../components/Content'
import HeaderSection from '../components/HeaderSection'
import Sidebar from '../components/Sidebar'
import DocFooter from '../components/DocFooter'
import styles from './Doc.module.scss'

export default class DocTemplate extends Component {
Expand Down Expand Up @@ -57,6 +58,8 @@ export default class DocTemplate extends Component {
__html: post.html
}}
/>

<DocFooter post={post} />
</article>
</main>
) : (
Expand All @@ -74,6 +77,8 @@ export default class DocTemplate extends Component {
__html: post.html
}}
/>

<DocFooter post={post} />
</article>
)}
</Content>
Expand All @@ -94,13 +99,15 @@ export const pageQuery = graphql`
id
excerpt
html
fileAbsolutePath
frontmatter {
title
description
}
fields {
section
}
...PageFooter
}

allSectionsYaml {
Expand All @@ -113,4 +120,12 @@ export const pageQuery = graphql`
}
}
}

fragment PageFooter on MarkdownRemark {
parent {
... on File {
relativePath
}
}
}
`