fix(client): remove algolia and hot keys modules from landing pages (#42394)

* fix(client): remove algolia and hot keys from landing pages

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Ahmad Abdolsaheb
2021-06-24 12:50:36 +03:00
committed by GitHub
parent db79a0a29a
commit b3f2c64de8
19 changed files with 332 additions and 215 deletions

View File

@ -6,6 +6,7 @@ import {
DefaultLayout
} from '../../src/components/layouts';
import FourOhFourPage from '../../src/pages/404';
import { isChallenge } from '../../src/utils/path-parsers';
export default function layoutSelector({ element, props }) {
const {
@ -18,32 +19,23 @@ export default function layoutSelector({ element, props }) {
{element}
</DefaultLayout>
);
}
if (/\/certification\//.test(pathname)) {
} else if (/\/certification\//.test(pathname)) {
return (
<CertificationLayout pathname={pathname}>{element}</CertificationLayout>
);
}
const splitPath = pathname.split('/').filter(x => x);
const isChallenge =
(splitPath.length === 4 && splitPath[0]) === 'learn' ||
(splitPath.length === 5 && splitPath[1]) === 'learn';
if (isChallenge) {
} else if (isChallenge(pathname)) {
return (
<DefaultLayout pathname={pathname} showFooter={false}>
{element}
</DefaultLayout>
);
} else {
return (
<DefaultLayout pathname={pathname} showFooter={true}>
{element}
</DefaultLayout>
);
}
return (
<DefaultLayout pathname={pathname} showFooter={true}>
{element}
</DefaultLayout>
);
}
layoutSelector.propTypes = {