This repository was archived by the owner on Jan 1, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from 'react'
22import BreadCrumbs from '../breadcrumbs'
33import PrevNext from '../prev-next'
4+ import EditIcon from '@material-ui/icons/Edit'
5+ import IconButton from '@material-ui/core/IconButton'
46import './default.scss'
57
8+ const EditLink = ( { edit= false } ) => edit
9+ ? < IconButton
10+ className = 'editpencil'
11+ href = { `https://github.com/freesewing/markdown/edit/develop/dev/${ edit } /en.md` }
12+ target = '_BLANK'
13+ rel = 'nofollow'
14+ size = 'small'
15+ title = 'Edit this page'
16+ > < EditIcon /> </ IconButton >
17+ : null
18+
619const DefaultLayout = ( props ) => {
720 return (
821 < div className = "layout-wrapper" >
@@ -14,7 +27,7 @@ const DefaultLayout = (props) => {
1427 </ aside >
1528 < section >
1629 { ! props . noCrumbs && < BreadCrumbs crumbs = { props . crumbs } pageTitle = { props . title } /> }
17- { ! props . noTitle && < h1 > { props . title } </ h1 > }
30+ { ! props . noTitle && < h1 > { props . title } < EditLink edit = { props . edit } /> < /h1 > }
1831 < div className = { `content ${ props . wide ? 'wide' : '' } ` } >
1932 { props . children }
2033 < PrevNext prev = { props . prev } next = { props . next } />
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ section#mdx table {
3131 }
3232}
3333
34+ a .editpencil {
35+ margin : 0 0 0 1rem ;
36+ }
37+
3438// Main page content layout
3539div .layout-wrapper {
3640 width : 100% ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ const Page = props => {
2121 title = { props . pageContext . title }
2222 description = { node . excerpt }
2323 { ...app . treeProps ( props . path ) }
24+ edit = { props . data . allMdx . edges [ 0 ] . node . parent . relativeDirectory }
2425 >
2526 < Mdx node = { props . data . allMdx . edges [ 0 ] . node } offspring = { app . getOffspring ( props . path ) } />
2627 { props . path === '/tutorials/' && < Tutorials list /> }
@@ -39,6 +40,7 @@ export const pageQuery = graphql`
3940 allMdx(filter: { fileAbsolutePath: { eq: $file } }) {
4041 edges {
4142 node {
43+ parent { ... on File { relativeDirectory } }
4244 body
4345 excerpt
4446 frontmatter {
You can’t perform that action at this time.
0 commit comments