* fix(client): Stop using react-responsive and use media queries to display menu * Change guide to show menu * DRYed out a bit * Restore main, top-right nav to guide * fix: Separate guide and top menu state * Update client/src/components/Header/index.js Co-Authored-By: Valeriy <ValeraS@users.noreply.github.com> * Update client/src/components/Header/index.js Co-Authored-By: Valeriy <ValeraS@users.noreply.github.com> * Update client/src/components/Header/index.js Co-Authored-By: Valeriy <ValeraS@users.noreply.github.com> * Update client/src/components/Header/index.js Co-Authored-By: Valeriy <ValeraS@users.noreply.github.com> * fix: Refactor menu button and links * feat(client): make top navigation menu replaceable * fix: Refactor nav menu logic out of Header * fix(client): use default nav menu in header and use landingPage props instead of disableSettings
63 lines
1.6 KiB
JavaScript
63 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { createStore } from './src/redux/createStore';
|
|
import AppMountNotifier from './src/components/AppMountNotifier';
|
|
|
|
import {
|
|
CertificationLayout,
|
|
DefaultLayout,
|
|
GuideLayout
|
|
} from './src/components/layouts';
|
|
import GuideNavMenu from './src/components/layouts/components/guide/NavMenu';
|
|
|
|
const store = createStore();
|
|
|
|
export const wrapRootElement = ({ element }) => {
|
|
return (
|
|
<Provider store={store}>
|
|
<AppMountNotifier render={() => element} />
|
|
</Provider>
|
|
);
|
|
};
|
|
|
|
wrapRootElement.propTypes = {
|
|
element: PropTypes.any
|
|
};
|
|
|
|
export const wrapPageElement = ({ element, props }) => {
|
|
const {
|
|
location: { pathname }
|
|
} = props;
|
|
if (pathname === '/') {
|
|
return (
|
|
<DefaultLayout disableSettings={true} landingPage={true}>
|
|
{element}
|
|
</DefaultLayout>
|
|
);
|
|
}
|
|
if (/^\/certification(\/.*)*/.test(pathname)) {
|
|
return <CertificationLayout>{element}</CertificationLayout>;
|
|
}
|
|
if (/^\/guide(\/.*)*/.test(pathname)) {
|
|
return (
|
|
<DefaultLayout navigationMenu={<GuideNavMenu />}>
|
|
<GuideLayout>{element}</GuideLayout>
|
|
</DefaultLayout>
|
|
);
|
|
}
|
|
if (/^\/learn(\/.*)*/.test(pathname)) {
|
|
return <DefaultLayout showFooter={false}>{element}</DefaultLayout>;
|
|
}
|
|
return <DefaultLayout>{element}</DefaultLayout>;
|
|
};
|
|
|
|
wrapPageElement.propTypes = {
|
|
element: PropTypes.any,
|
|
location: PropTypes.objectOf({ pathname: PropTypes.string }),
|
|
props: PropTypes.any
|
|
};
|
|
|
|
export const disableCorePrefetching = () => true;
|