fix(learn): split and simplified learn map (#39154)

This commit is contained in:
Kabindra Shrestha
2020-12-28 20:52:41 -06:00
committed by Mrugesh Mohapatra
parent 48c97238fc
commit ac3d762bb5
25 changed files with 694 additions and 963 deletions

View File

@ -122,7 +122,7 @@ exports.createSuperBlockIntroPages = createPage => edge => {
path: slug,
component: superBlockIntro,
context: {
superBlock: dasherize(superBlock),
superBlock: superBlock,
slug
}
});

View File

@ -11,6 +11,7 @@ export default function layoutSelector({ element, props }) {
const {
location: { pathname }
} = props;
if (element.type === FourOhFourPage) {
return <DefaultLayout pathname={pathname}>{element}</DefaultLayout>;
}
@ -22,10 +23,14 @@ export default function layoutSelector({ element, props }) {
if (/^\/guide(\/.*)*/.test(pathname)) {
console.log('Hitting guide for some reason. Need a redirect.');
}
if (
/^\/learn(\/.*)*/.test(pathname) &&
false === /^\/learn\/$|^\/learn$/.test(pathname)
) {
const splitPath = pathname.split('/');
const splitPathThree = splitPath.length > 2 ? splitPath[3] : '';
const isNotSuperBlockIntro =
splitPath.length > 3 && splitPathThree.length > 1;
if (/^\/learn(\/.*)*/.test(pathname) && isNotSuperBlockIntro) {
return (
<DefaultLayout pathname={pathname} showFooter={false}>
{element}