feat(client): add prev next btns to lessons (#35485)

* feat/add-prev-next-btns-to-lessons

redirect to learn instead of home

* fix/button-css-properties

* fix/change-buttons-to-suggested

* fix/add-tests+change-button-to-link

Co-authored-by: ojeytonwilliams ojeytonwilliams@gmail.com

* Revert "fix/add-tests+change-button-to-link"

This reverts commit ae26504d1d.

* fix/add-tests+change-button-to-link

Co-authored-by: ojeytonwilliams <ojeytonwilliams@gmail.com>
This commit is contained in:
Tom
2019-07-18 04:46:00 -05:00
committed by mrugesh
parent eba8953037
commit 8757deb56c
11 changed files with 233 additions and 14 deletions

View File

@ -34,8 +34,14 @@ const views = {
const getNextChallengePath = (node, index, nodeArray) => {
const next = nodeArray[index + 1];
return next ? next.node.fields.slug : '/';
return next ? next.node.fields.slug : '/learn';
};
const getPrevChallengePath = (node, index, nodeArray) => {
const prev = nodeArray[index - 1];
return prev ? prev.node.fields.slug : '/learn';
};
const getTemplateComponent = challengeType => views[viewTypes[challengeType]];
const getIntroIfRequired = (node, index, nodeArray) => {
@ -74,6 +80,7 @@ exports.createChallengePages = createPage => ({ node }, index, thisArray) => {
template,
required,
nextChallengePath: getNextChallengePath(node, index, thisArray),
prevChallengePath: getPrevChallengePath(node, index, thisArray),
id
},
slug