fix(client): do not unmount default layout on navigate

This commit is contained in:
Valeriy
2019-01-23 00:53:35 +03:00
committed by Stuart Taylor
parent a284b296fc
commit 28ee458ceb
16 changed files with 143 additions and 130 deletions

View File

@ -7,6 +7,7 @@ import headComponents from './src/head';
import { createStore } from './src/redux/createStore';
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
import DefaultLayout from './src/components/layouts/Default';
const store = createStore();
@ -22,6 +23,26 @@ wrapRootElement.propTypes = {
element: PropTypes.any
};
export const wrapPageElement = ({ element, props }) => {
const {
location: { pathname }
} = props;
if (pathname === '/') {
return (
<DefaultLayout disableSettings={true} landingPage={true}>
{element}
</DefaultLayout>
);
}
return <DefaultLayout>{element}</DefaultLayout>;
};
wrapPageElement.propTypes = {
element: PropTypes.any,
location: PropTypes.objectOf({ pathname: PropTypes.string }),
props: PropTypes.any
};
export const onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => {
setHeadComponents([...headComponents]);
setPostBodyComponents(