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

@ -5,6 +5,7 @@ import { Provider } from 'react-redux';
import { createStore } from './src/redux/createStore';
import AppMountNotifier from './src/components/AppMountNotifier';
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
import DefaultLayout from './src/components/layouts/Default';
const store = createStore();
@ -21,3 +22,23 @@ export const wrapRootElement = ({ element }) => {
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
};