From cef7859c9ab4960671004c9032986be78cf52ccf Mon Sep 17 00:00:00 2001 From: Sriram Thiagarajan Date: Mon, 26 Mar 2018 09:29:05 +0530 Subject: [PATCH 1/7] move plugins page from /packages to /plugins --- www/gatsby-node.js | 8 +++++++- www/src/components/navigation-mobile.js | 2 +- www/src/components/navigation.js | 2 +- www/src/components/searchbar-body.js | 2 +- www/src/layouts/index.js | 6 +++--- www/src/pages/{packages.js => plugins.js} | 0 6 files changed, 13 insertions(+), 7 deletions(-) rename www/src/pages/{packages.js => plugins.js} (100%) diff --git a/www/gatsby-node.js b/www/gatsby-node.js index 7b5171f906f65..15d0ec10e3ddd 100644 --- a/www/gatsby-node.js +++ b/www/gatsby-node.js @@ -34,6 +34,12 @@ exports.createPages = ({ graphql, boundActionCreators }) => { isPermanent: true, }) + createRedirect({ + fromPath: `/packages/`, // Moved "Plugins" page from /packages to /plugins + toPath: `/plugins/`, + isPermanent: true, + }) + return new Promise((resolve, reject) => { const docsTemplate = path.resolve(`src/templates/template-docs-markdown.js`) const blogPostTemplate = path.resolve(`src/templates/template-blog-post.js`) @@ -230,7 +236,7 @@ exports.onCreateNode = ({ node, boundActionCreators, getNode }) => { fileNode.sourceInstanceName === `packages` && parsedFilePath.name === `README` ) { - slug = `/packages/${parsedFilePath.dir}/` + slug = `/plugins/${parsedFilePath.dir}/` createNodeField({ node, name: `title`, diff --git a/www/src/components/navigation-mobile.js b/www/src/components/navigation-mobile.js index 9140644af5432..39944104ad987 100644 --- a/www/src/components/navigation-mobile.js +++ b/www/src/components/navigation-mobile.js @@ -52,7 +52,7 @@ const MobileNavigation = () => ( > - + ) diff --git a/www/src/components/navigation.js b/www/src/components/navigation.js index 0c272b3f5f657..61a4bc2ed159e 100644 --- a/www/src/components/navigation.js +++ b/www/src/components/navigation.js @@ -152,7 +152,7 @@ export default ({ pathname }) => { > Docs Tutorial - Plugins + Plugins Features Blog diff --git a/www/src/components/searchbar-body.js b/www/src/components/searchbar-body.js index 9c5851223ad51..85d71160447b6 100644 --- a/www/src/components/searchbar-body.js +++ b/www/src/components/searchbar-body.js @@ -310,7 +310,7 @@ const Result = ({ hit, pathname, search }) => { return ( { - if (this.props.location.pathname.slice(0, 9) === `/packages`) { + if (this.props.location.pathname.slice(0, 8) === `/plugins`) { return packageSidebarWidth } else if (hasSidebar) { return rhythm(rhythmSize) diff --git a/www/src/pages/packages.js b/www/src/pages/plugins.js similarity index 100% rename from www/src/pages/packages.js rename to www/src/pages/plugins.js From 44079449270a7869f0835dcc9a4d841b20a334b8 Mon Sep 17 00:00:00 2001 From: Sriram Thiagarajan Date: Mon, 26 Mar 2018 22:02:26 +0530 Subject: [PATCH 2/7] revert package slug to /packages --- www/gatsby-node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/gatsby-node.js b/www/gatsby-node.js index 15d0ec10e3ddd..1dd5e997c5844 100644 --- a/www/gatsby-node.js +++ b/www/gatsby-node.js @@ -236,7 +236,7 @@ exports.onCreateNode = ({ node, boundActionCreators, getNode }) => { fileNode.sourceInstanceName === `packages` && parsedFilePath.name === `README` ) { - slug = `/plugins/${parsedFilePath.dir}/` + slug = `/packages/${parsedFilePath.dir}/` createNodeField({ node, name: `title`, From 9bf991dbdbf078c83bd340265aeba38ed1a52b6f Mon Sep 17 00:00:00 2001 From: Sriram Thiagarajan Date: Tue, 27 Mar 2018 09:13:14 +0530 Subject: [PATCH 3/7] /packages instead of /plugins as path for packages --- www/src/components/searchbar-body.js | 2 +- www/src/layouts/index.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/www/src/components/searchbar-body.js b/www/src/components/searchbar-body.js index 85d71160447b6..9c5851223ad51 100644 --- a/www/src/components/searchbar-body.js +++ b/www/src/components/searchbar-body.js @@ -310,7 +310,7 @@ const Result = ({ hit, pathname, search }) => { return ( { - if (this.props.location.pathname.slice(0, 8) === `/plugins`) { + if ( + this.props.location.pathname.slice(0, 8) === `/plugins` || + this.props.location.pathname.slice(0, 9) === `/packages` + ) { return packageSidebarWidth } else if (hasSidebar) { return rhythm(rhythmSize) From 44967da81d3feb96948aed11c1965e53603fd739 Mon Sep 17 00:00:00 2001 From: Sriram Thiagarajan Date: Tue, 27 Mar 2018 09:13:59 +0530 Subject: [PATCH 4/7] fix formatting --- www/src/components/search-form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/src/components/search-form.js b/www/src/components/search-form.js index 8c59f4e3212fa..b56ea38463a31 100644 --- a/www/src/components/search-form.js +++ b/www/src/components/search-form.js @@ -283,7 +283,7 @@ class SearchForm extends Component { openOnFocus: true, autoselect: true, hint: false, - keyboardShortcuts: ['s'] + keyboardShortcuts: [`s`], }, }) } From 1787a8fc46cddef562d95157621120d0fbbba678 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 27 Mar 2018 15:00:58 -0700 Subject: [PATCH 5/7] Update index.js --- www/src/layouts/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/src/layouts/index.js b/www/src/layouts/index.js index 7862f80337b8e..b532f8baa6d0a 100644 --- a/www/src/layouts/index.js +++ b/www/src/layouts/index.js @@ -35,7 +35,6 @@ class DefaultLayout extends React.Component { this.props.location.pathname.slice(0, 8) === `/plugins` || this.props.location.pathname.slice(0, 9) === `/packages` const isPackageReadme = - this.props.location.pathname.slice(0, 15) === `/plugins/gatsby` || this.props.location.pathname.slice(0, 16) === `/packages/gatsby` const hasSidebar = From 93c7b083173ffa804bada55789e7371fa8d660c3 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 27 Mar 2018 15:07:01 -0700 Subject: [PATCH 6/7] Update index.js --- www/src/layouts/index.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/www/src/layouts/index.js b/www/src/layouts/index.js index b532f8baa6d0a..1b3073071192e 100644 --- a/www/src/layouts/index.js +++ b/www/src/layouts/index.js @@ -31,23 +31,19 @@ class DefaultLayout extends React.Component { const isTutorial = this.props.location.pathname.slice(0, 10) === `/tutorial/` const isFeature = this.props.location.pathname.slice(0, 9) === `/features` - const isPackage = - this.props.location.pathname.slice(0, 8) === `/plugins` || - this.props.location.pathname.slice(0, 9) === `/packages` + const isPackageSearchPage = + this.props.location.pathname.slice(0, 8) === `/plugins` const isPackageReadme = this.props.location.pathname.slice(0, 16) === `/packages/gatsby` const hasSidebar = - isDoc || isTutorial || isFeature || isPackage || isPackageReadme + isDoc || isTutorial || isFeature || isPackageSearchPage || isPackageReadme const isSearchSource = hasSidebar || isBlog const packageSidebarWidth = rhythm(17) const leftPadding = rhythmSize => { - if ( - this.props.location.pathname.slice(0, 8) === `/plugins` || - this.props.location.pathname.slice(0, 9) === `/packages` - ) { + if (isPackageReadme || isPackageSearchPage) { return packageSidebarWidth } else if (hasSidebar) { return rhythm(rhythmSize) @@ -88,11 +84,11 @@ class DefaultLayout extends React.Component { let searchBarDisplayProperty let childrenMobileDisplay let childrenTabletDisplay - if (isPackage && !isPackageReadme) { + if (isPackageSearchPage && !isPackageReadme) { searchBarDisplayProperty = { display: `block` } childrenMobileDisplay = { display: `none` } childrenTabletDisplay = { display: `block` } - } else if (isPackage && isPackageReadme) { + } else if (isPackageSearchPage && isPackageReadme) { searchBarDisplayProperty = { [presets.Mobile]: { display: `none`, @@ -160,9 +156,9 @@ class DefaultLayout extends React.Component { css={{ ...searchbarStyles, [presets.Tablet]: { - display: isPackage + display: isPackageSearchPage ? `block` - : isPackage && isPackageReadme ? `block` : `none`, + : isPackageSearchPage && isPackageReadme ? `block` : `none`, width: packageSidebarWidth, position: `fixed`, background: colors.ui.whisper, From bd45464b37125aedc3d27a2fea94a33e223331ba Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 27 Mar 2018 15:36:19 -0700 Subject: [PATCH 7/7] Fix sidebar --- www/src/layouts/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/src/layouts/index.js b/www/src/layouts/index.js index 1b3073071192e..0902fdca7c97e 100644 --- a/www/src/layouts/index.js +++ b/www/src/layouts/index.js @@ -32,7 +32,8 @@ class DefaultLayout extends React.Component { this.props.location.pathname.slice(0, 10) === `/tutorial/` const isFeature = this.props.location.pathname.slice(0, 9) === `/features` const isPackageSearchPage = - this.props.location.pathname.slice(0, 8) === `/plugins` + this.props.location.pathname.slice(0, 8) === `/plugins` || + this.props.location.pathname.slice(0, 9) === `/packages` const isPackageReadme = this.props.location.pathname.slice(0, 16) === `/packages/gatsby`