From 3b255202393a1db5d577f500088bd5a2683f07fc Mon Sep 17 00:00:00 2001 From: Emily Plummer Date: Thu, 25 Apr 2019 13:19:02 -0700 Subject: [PATCH 1/3] add edit link --- pages/_app.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pages/_app.js b/pages/_app.js index a1436d52d5..3a51cf8e28 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -2,7 +2,8 @@ import React from 'react' import App, {Container} from 'next/app' import {MDXProvider} from '@mdx-js/tag' import Head from 'next/head' -import {BaseStyles, BorderBox, Box, Flex, theme} from '@primer/components' +import Octicon, {iconsByName, Pencil} from '@githubprimer/octicons-react' +import {BaseStyles, Link, Text, StyledOcticon, BorderBox, Box, Flex, theme} from '@primer/components' import {PackageHeader} from '../docs/components' import {Header, JumpNav, Section, Router, RouteMatch, SectionLink, SideNav} from '@primer/blueprints' import {NavList} from '@primer/blueprints/dist/next-components-index.umd.js' @@ -10,9 +11,12 @@ import getComponents from '../docs/markdown' import documents from '../searchIndex' import {config, requirePage, rootPage} from '../docs/utils' import {CONTENT_MAX_WIDTH} from '../docs/constants' +import {repository} from '../package.json' import '../src/index.scss' +const DocLink = props => + export default class MyApp extends App { static async getInitialProps({Component, ctx}) { let page = {} @@ -30,6 +34,8 @@ export default class MyApp extends App { const {Component, page} = this.props const node = rootPage.first(node => node.path === pathname) || {} const {file, meta = {}} = node || {} + const isIndex = file.includes('index') + const editLinkBase = `${repository}/edit/master/pages` const components = getComponents(node) const Hero = file ? requirePage(file).Hero : null @@ -69,6 +75,17 @@ export default class MyApp extends App {
{JSON.stringify(meta, null, 2)}
)} + {pathname && ( + + + + + + Edit this page + {' '} + on GitHub + + )} From 280a3080be2b2ba733628a479b332ed97df2c4be Mon Sep 17 00:00:00 2001 From: Emily Plummer Date: Tue, 30 Apr 2019 11:19:12 -0700 Subject: [PATCH 2/3] e --- pages/_app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/_app.js b/pages/_app.js index a89adb2d9b..fcd458656f 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -2,10 +2,10 @@ import React from 'react' import App, {Container} from 'next/app' import {MDXProvider} from '@mdx-js/tag' import Head from 'next/head' -import Octicon, {iconsByName, Pencil} from '@githubprimer/octicons-react' -import {BaseStyles, Link, Text, StyledOcticon, BorderBox, Box, Flex, theme} from '@primer/components' +import Octicon, {Pencil} from '@githubprimer/octicons-react' +import {BaseStyles, Link, Text, BorderBox, Box, Flex, theme} from '@primer/components' import {PackageHeader} from '../docs/components' -import {Header, JumpNav, Section, Router, RouteMatch, SectionLink, SideNav} from '@primer/blueprints' +import {Header, JumpNav,SideNav} from '@primer/blueprints' import {NavList} from '@primer/blueprints/next-components' import getComponents from '../docs/markdown' import documents from '../searchIndex' From 58221b781500220a5967ec59b326fdf244d2c3c2 Mon Sep 17 00:00:00 2001 From: Emily Plummer Date: Tue, 30 Apr 2019 13:46:26 -0700 Subject: [PATCH 3/3] move editLinkBase out of render function --- pages/_app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/_app.js b/pages/_app.js index 94dcdac857..99537ab2b2 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -16,6 +16,7 @@ import {repository} from '../package.json' import '../src/index.scss' const DocLink = props => +const editLinkBase = `${repository}/edit/master/pages` export default class MyApp extends App { static async getInitialProps({Component, ctx}) { @@ -35,7 +36,6 @@ export default class MyApp extends App { const node = rootPage.first(node => node.path === pathname) || {} const {file, meta = {}} = node || {} const isIndex = file.includes('index') - const editLinkBase = `${repository}/edit/master/pages` const components = getComponents(node) const Hero = file ? requirePage(file).Hero : null