Skip to content

Commit

Permalink
Merge pull request #223 from heitorlessa/docs/add-source-code-link
Browse files Browse the repository at this point in the history
docs: add source code link in nav bar
  • Loading branch information
heitorlessa authored Nov 27, 2020
2 parents 704eba7 + e972257 commit fa34d82
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/src/gatsby-theme-apollo-docs/components/page-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default function PageContent(props) {

const githubUrl = props.githubUrl.replace("tree/", "blob/")
.replace("/content/", "/docs/content/")
const sourceUrl = /.+?(?=tree)/.exec(props.githubUrl)

const editLink = githubUrl && (
<AsideLink href={githubUrl}>
Expand Down Expand Up @@ -210,6 +211,9 @@ export default function PageContent(props) {
/>
)}
{editLink}
<AsideLink href={sourceUrl}>
<IconGithub /> Source code
</AsideLink>
</Aside>
</Wrapper>
);
Expand All @@ -218,11 +222,11 @@ export default function PageContent(props) {
PageContent.propTypes = {
children: PropTypes.node.isRequired,
pathname: PropTypes.string.isRequired,
githubUrl: PropTypes.string,
githubUrl: PropTypes.string.isRequired,
pages: PropTypes.array.isRequired,
hash: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
graphManagerUrl: PropTypes.string.isRequired,
graphManagerUrl: PropTypes.string,
headings: PropTypes.array.isRequired,
spectrumUrl: PropTypes.string
};

0 comments on commit fa34d82

Please sign in to comment.