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:
@ -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
|
||||
|
Reference in New Issue
Block a user