fix(footer): show only on non-learn pages
This commit is contained in:
committed by
Stuart Taylor
parent
b94c87494c
commit
71cf52144e
@ -6,7 +6,7 @@ import { createStore } from './src/redux/createStore';
|
|||||||
import AppMountNotifier from './src/components/AppMountNotifier';
|
import AppMountNotifier from './src/components/AppMountNotifier';
|
||||||
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
|
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
|
||||||
import DefaultLayout from './src/components/layouts/Default';
|
import DefaultLayout from './src/components/layouts/Default';
|
||||||
import GuideLayout from './src/components/layouts/GuideLayout';
|
import GuideLayout from './src/components/layouts/Guide';
|
||||||
|
|
||||||
const store = createStore();
|
const store = createStore();
|
||||||
|
|
||||||
@ -30,18 +30,29 @@ export const wrapPageElement = ({ element, props }) => {
|
|||||||
} = props;
|
} = props;
|
||||||
if (pathname === '/') {
|
if (pathname === '/') {
|
||||||
return (
|
return (
|
||||||
<DefaultLayout disableSettings={true} landingPage={true}>
|
<DefaultLayout
|
||||||
|
disableSettings={true}
|
||||||
|
landingPage={true}
|
||||||
|
nonLearnPage={true}
|
||||||
|
>
|
||||||
{element}
|
{element}
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ((/^\/guide(\/.*)*/).test(pathname)) {
|
if ((/^\/guide(\/.*)*/).test(pathname)) {
|
||||||
return (
|
return (
|
||||||
<DefaultLayout>
|
<DefaultLayout nonLearnPage={true}>
|
||||||
<GuideLayout>{element}</GuideLayout>
|
<GuideLayout>{element}</GuideLayout>
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (false === (/^\/learn(\/.*)*/).test(pathname)) {
|
||||||
|
return (
|
||||||
|
<DefaultLayout nonLearnPage={true}>
|
||||||
|
{element}
|
||||||
|
</DefaultLayout>
|
||||||
|
);
|
||||||
|
}
|
||||||
return <DefaultLayout>{element}</DefaultLayout>;
|
return <DefaultLayout>{element}</DefaultLayout>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import { createStore } from './src/redux/createStore';
|
|||||||
|
|
||||||
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
|
import GuideNavContextProvider from './src/contexts/GuideNavigationContext';
|
||||||
import DefaultLayout from './src/components/layouts/Default';
|
import DefaultLayout from './src/components/layouts/Default';
|
||||||
import GuideLayout from './src/components/layouts/GuideLayout';
|
import GuideLayout from './src/components/layouts/Guide';
|
||||||
|
|
||||||
const store = createStore();
|
const store = createStore();
|
||||||
|
|
||||||
@ -30,18 +30,29 @@ export const wrapPageElement = ({ element, props }) => {
|
|||||||
} = props;
|
} = props;
|
||||||
if (pathname === '/') {
|
if (pathname === '/') {
|
||||||
return (
|
return (
|
||||||
<DefaultLayout disableSettings={true} landingPage={true}>
|
<DefaultLayout
|
||||||
|
disableSettings={true}
|
||||||
|
landingPage={true}
|
||||||
|
nonLearnPage={true}
|
||||||
|
>
|
||||||
{element}
|
{element}
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ((/^\/guide(\/.*)*/).test(pathname)) {
|
if ((/^\/guide(\/.*)*/).test(pathname)) {
|
||||||
return (
|
return (
|
||||||
<DefaultLayout>
|
<DefaultLayout nonLearnPage={true}>
|
||||||
<GuideLayout>{element}</GuideLayout>
|
<GuideLayout>{element}</GuideLayout>
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (false === (/^\/learn(\/.*)*/).test(pathname)) {
|
||||||
|
return (
|
||||||
|
<DefaultLayout nonLearnPage={true}>
|
||||||
|
{element}
|
||||||
|
</DefaultLayout>
|
||||||
|
);
|
||||||
|
}
|
||||||
return <DefaultLayout>{element}</DefaultLayout>;
|
return <DefaultLayout>{element}</DefaultLayout>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import OfflineWarning from '../OfflineWarning';
|
|||||||
import Flash from '../Flash';
|
import Flash from '../Flash';
|
||||||
import Header from '../Header';
|
import Header from '../Header';
|
||||||
import Footer from '../Footer';
|
import Footer from '../Footer';
|
||||||
import Spacer from '../helpers/Spacer';
|
|
||||||
|
|
||||||
import './global.css';
|
import './global.css';
|
||||||
import './layout.css';
|
import './layout.css';
|
||||||
@ -70,6 +69,7 @@ const propTypes = {
|
|||||||
isOnline: PropTypes.bool.isRequired,
|
isOnline: PropTypes.bool.isRequired,
|
||||||
isSignedIn: PropTypes.bool,
|
isSignedIn: PropTypes.bool,
|
||||||
landingPage: PropTypes.bool,
|
landingPage: PropTypes.bool,
|
||||||
|
nonLearnPage: PropTypes.bool,
|
||||||
onlineStatusChange: PropTypes.func.isRequired,
|
onlineStatusChange: PropTypes.func.isRequired,
|
||||||
removeFlashMessage: PropTypes.func.isRequired
|
removeFlashMessage: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
@ -139,6 +139,7 @@ class DefaultLayout extends Component {
|
|||||||
flashMessages = [],
|
flashMessages = [],
|
||||||
removeFlashMessage,
|
removeFlashMessage,
|
||||||
landingPage,
|
landingPage,
|
||||||
|
nonLearnPage,
|
||||||
isOnline,
|
isOnline,
|
||||||
isSignedIn
|
isSignedIn
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -165,9 +166,7 @@ class DefaultLayout extends Component {
|
|||||||
) : null}
|
) : null}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
{nonLearnPage ? (<Footer />) : null}
|
||||||
<Spacer size={3}/>
|
|
||||||
<Footer />
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import Spacer from '../helpers/Spacer';
|
|||||||
|
|
||||||
import 'prismjs/themes/prism.css';
|
import 'prismjs/themes/prism.css';
|
||||||
import './guide.css';
|
import './guide.css';
|
||||||
|
import Footer from '../Footer';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
children: PropTypes.any,
|
children: PropTypes.any,
|
||||||
@ -29,7 +30,7 @@ const propTypes = {
|
|||||||
location: PropTypes.object
|
location: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
class Layout extends React.Component {
|
class GuideLayout extends React.Component {
|
||||||
getContentRef = ref => (this.contentRef = ref);
|
getContentRef = ref => (this.contentRef = ref);
|
||||||
|
|
||||||
handleNavigation = () => {
|
handleNavigation = () => {
|
||||||
@ -41,7 +42,7 @@ class Layout extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<StaticQuery
|
<StaticQuery
|
||||||
query={graphql`
|
query={graphql`
|
||||||
query LayoutQuery {
|
query GuideLayoutQuery {
|
||||||
allNavigationNode {
|
allNavigationNode {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@ -110,7 +111,7 @@ class Layout extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.displayName = 'Layout';
|
GuideLayout.displayName = 'GuideLayout';
|
||||||
Layout.propTypes = propTypes;
|
GuideLayout.propTypes = propTypes;
|
||||||
|
|
||||||
export default Layout;
|
export default GuideLayout;
|
Reference in New Issue
Block a user