@@ -2,17 +2,22 @@ import React from 'react'
22import App , { Container } from 'next/app'
33import { MDXProvider } from '@mdx-js/tag'
44import Head from 'next/head'
5- import { BaseStyles , BorderBox , Box , Flex , theme } from '@primer/components'
5+ import Octicon , { Pencil } from '@githubprimer/octicons-react'
6+ import { BaseStyles , Link , Text , BorderBox , Box , Flex , theme } from '@primer/components'
67import { PackageHeader } from '../docs/components'
78import { Header , MarkdownHeading , JumpNav , SideNav } from '@primer/blueprints'
89import { NavList } from '@primer/blueprints/next-components'
910import getComponents from '../docs/markdown'
1011import documents from '../searchIndex'
1112import { config , requirePage , rootPage } from '../docs/utils'
1213import { CONTENT_MAX_WIDTH } from '../docs/constants'
14+ import { repository } from '../package.json'
1315
1416import '../src/index.scss'
1517
18+ const DocLink = props => < Link nounderline { ...props } />
19+ const editLinkBase = `${ repository } /edit/master/pages`
20+
1621export default class MyApp extends App {
1722 static async getInitialProps ( { Component, ctx} ) {
1823 let page = { }
@@ -30,6 +35,7 @@ export default class MyApp extends App {
3035 const { Component, page} = this . props
3136 const node = rootPage . first ( node => node . path === pathname ) || { }
3237 const { file, meta = { } } = node || { }
38+ const isIndex = file . includes ( 'index' )
3339 const components = getComponents ( node )
3440
3541 const Hero = file ? requirePage ( file ) . Hero : null
@@ -69,6 +75,17 @@ export default class MyApp extends App {
6975 < pre > { JSON . stringify ( meta , null , 2 ) } </ pre >
7076 </ details >
7177 ) }
78+ { pathname && (
79+ < Box color = "gray.5" borderColor = "gray.2" borderTop = { 1 } my = { 6 } pt = { 2 } >
80+ < Text mr = { 2 } >
81+ < Octicon icon = { Pencil } />
82+ </ Text >
83+ < DocLink muted href = { `${ editLinkBase } ${ pathname } ${ isIndex ? '/index' : '' } .md` } >
84+ Edit this page
85+ </ DocLink > { ' ' }
86+ on GitHub
87+ </ Box >
88+ ) }
7289 </ div >
7390 </ Box >
7491 </ Box >
0 commit comments