From e6fc0825bcdbd9ab04beec8c146ccb0bac1e5fea Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 Mar 2020 11:10:47 -0600 Subject: [PATCH 1/2] added logic and style --- .../src/components/NextPrevious/NextPrevious.js | 16 +++++++++------- .../NextPrevious/NextPrevious.module.scss | 4 ++++ .../NextPrevious/NextPreviousStyles.js | 11 +++++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js index 046690ff0..f0785d379 100644 --- a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js +++ b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js @@ -144,12 +144,10 @@ const NextPreviousContainer = props => { }; } - return currentTitle === 'Home' - ? {} - : { - to: '/', - name: 'Home', - }; + return { + to: '/', + name: 'Home', + }; }; const getNextItem = () => { @@ -189,7 +187,11 @@ const NextPreviousContainer = props => { } return ( - + ); }; diff --git a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.module.scss b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.module.scss index f69dcfe2f..9dd5aeb08 100644 --- a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.module.scss +++ b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.module.scss @@ -37,3 +37,7 @@ @include carbon--type-style('expressive-heading-03', true); padding-bottom: $spacing-05; } + +.isHomepage { + visibility: hidden; +} diff --git a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPreviousStyles.js b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPreviousStyles.js index f42ff731d..ed0993f8a 100644 --- a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPreviousStyles.js +++ b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPreviousStyles.js @@ -1,4 +1,5 @@ import React from 'react'; +import cx from 'classnames'; import { Link } from 'gatsby'; import { Row, Column, Grid } from '../Grid'; @@ -9,14 +10,20 @@ import { name, linkContainer, grid, + isHomepage as isHomepageStyles, } from './NextPrevious.module.scss'; -const NextPreviousContainer = ({ previousItem, nextItem }) => ( +const NextPreviousContainer = ({ previousItem, nextItem, isHomepage }) => (
{previousItem.to && ( - +
Previous
{previousItem.name}
From 5e57dfd7c4a5e8bc95ef0c719f1917a8d8d7aea5 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 5 Mar 2020 12:43:38 -0600 Subject: [PATCH 2/2] added isHomepage prop to the container and to homepage.js template --- .../src/components/NextPrevious/NextPrevious.js | 3 ++- packages/gatsby-theme-carbon/src/templates/Homepage.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js index f0785d379..70298dc50 100644 --- a/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js +++ b/packages/gatsby-theme-carbon/src/components/NextPrevious/NextPrevious.js @@ -102,6 +102,7 @@ const NextPreviousContainer = props => { const { tabs, location, + isHomepage, pageContext = { frontmatter: 'Home', }, @@ -188,7 +189,7 @@ const NextPreviousContainer = props => { return ( diff --git a/packages/gatsby-theme-carbon/src/templates/Homepage.js b/packages/gatsby-theme-carbon/src/templates/Homepage.js index 97b84e134..ad7ded9d1 100644 --- a/packages/gatsby-theme-carbon/src/templates/Homepage.js +++ b/packages/gatsby-theme-carbon/src/templates/Homepage.js @@ -30,7 +30,7 @@ const Homepage = ({ {FirstCallout}
{children}
{SecondCallout} - + );