From 585783e9b7256044c48d0395e9396a658caff603 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Fri, 1 Sep 2017 22:38:19 +0200 Subject: [PATCH] [docs] Fix ROADMAP page issues (#8008) --- ROADMAP.md | 3 +-- docs/src/modules/components/MarkdownDocs.js | 30 ++++++++++++--------- pages/discover-more/roadmap.js | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 67973bd7ecad23..0f557abed0dec9 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -76,8 +76,7 @@ That conversation could start on one of the following [issues](https://github.co ### How do I know if a component still needs to be migrated `v1-beta`? -We have [Github project](https://github.com/callemall/material-ui/projects/1) to **coordinate** the work toward the `v1-beta` release. -You can check the *Component to migrate* column to know the ones needing to be migrated to `v1-beta`. +We have [some open issues](https://github.com/callemall/material-ui/issues?q=is%3Aopen+is%3Aissue+label%3ARefactoring+label%3Av1) to **coordinate** the work toward the `v1.0.0` release. ### How do I start migrating components to the `v1-beta` branch? diff --git a/docs/src/modules/components/MarkdownDocs.js b/docs/src/modules/components/MarkdownDocs.js index 2f96a33dc93ca1..1b9db9c06d5164 100644 --- a/docs/src/modules/components/MarkdownDocs.js +++ b/docs/src/modules/components/MarkdownDocs.js @@ -27,22 +27,25 @@ const demoRegexp = /^demo='(.*)'$/; const SOURCE_CODE_ROOT_URL = 'https://github.com/callemall/material-ui/tree/v1-beta'; function MarkdownDocs(props, context) { - const { classes, demos, markdown } = props; + const { classes, demos, markdown, sourceLocation: sourceLocationProp } = props; const contents = getContents(markdown); const components = getComponents(markdown); - let sourceLocation = context.activePage.pathname; - // Hack for handling the nested demos - if (sourceLocation.indexOf('/demos') === 0) { - const token = sourceLocation.split('/'); - token.push(token[token.length - 1]); - sourceLocation = token.join('/'); - } + let sourceLocation = sourceLocationProp || context.activePage.pathname; + + if (!sourceLocationProp) { + // Hack for handling the nested demos + if (sourceLocation.indexOf('/demos') === 0) { + const token = sourceLocation.split('/'); + token.push(token[token.length - 1]); + sourceLocation = token.join('/'); + } - if (sourceLocation.indexOf('/api') === 0) { - sourceLocation = `/pages/${sourceLocation}.md`; - } else { - sourceLocation = `/docs/src/pages${sourceLocation}.md`; + if (sourceLocation.indexOf('/api') === 0) { + sourceLocation = `/pages/${sourceLocation}.md`; + } else { + sourceLocation = `/docs/src/pages${sourceLocation}.md`; + } } return ( @@ -85,6 +88,9 @@ MarkdownDocs.propTypes = { classes: PropTypes.object.isRequired, demos: PropTypes.object, markdown: PropTypes.string.isRequired, + // You can define the direction location of the markdown file. + // Otherwise, we try to determine it with an heuristic. + sourceLocation: PropTypes.string, }; MarkdownDocs.contextTypes = { diff --git a/pages/discover-more/roadmap.js b/pages/discover-more/roadmap.js index f0b527ee160f64..1a05caab8ae83e 100644 --- a/pages/discover-more/roadmap.js +++ b/pages/discover-more/roadmap.js @@ -6,7 +6,7 @@ import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; import markdown from '../../ROADMAP.md'; function Page() { - return ; + return ; } export default withRoot(Page);