Add StaticPage component

This commit is contained in:
Kimmo Puputti 2017-10-17 15:49:24 +03:00 committed by Vesa Luusua
parent 97b5f0563f
commit 8776cfe785
4 changed files with 52 additions and 0 deletions

View file

@ -13,3 +13,4 @@ Documentation for specific topics can be found in the following files:
- [Testing](testing.md)
- [Error logging with Sentry](sentry.md)
- [CI](ci.md)
- [Static pages](static-pages.md)

15
docs/static-pages.md Normal file
View file

@ -0,0 +1,15 @@
# Static pages
TODO
## Creating the component
TODO
## Adding the component to the index of components
TODO
## Adding a route for the component
TODO

View file

@ -0,0 +1,35 @@
import React from 'react';
import { node } from 'prop-types';
import { connect } from 'react-redux';
import { isScrollingDisabled } from '../../ducks/UI.duck';
import { Page } from '../../components';
const StaticPageComponent = props => {
const { children, ...pageProps } = props;
return (
<Page {...pageProps}>
{children}
</Page>
);
};
StaticPageComponent.defaultProps = {
children: null,
};
StaticPageComponent.propTypes = {
children: node,
};
const mapStateToProps = state => {
const { authInfoError, logoutError } = state.Auth;
return {
authInfoError,
logoutError,
scrollingDisabled: isScrollingDisabled(state),
};
};
const StaticPage = connect(mapStateToProps)(StaticPageComponent);
export default StaticPage;

View file

@ -37,6 +37,7 @@ export { default as SalePage } from './SalePage/SalePage';
export { default as SearchPage } from './SearchPage/SearchPage';
export { default as SecurityPage } from './SecurityPage/SecurityPage';
export { default as SignupForm } from './SignupForm/SignupForm';
export { default as StaticPage } from './StaticPage/StaticPage';
export { default as StripePaymentForm } from './StripePaymentForm/StripePaymentForm';
export { default as StyleguidePage } from './StyleguidePage/StyleguidePage';
export { default as TopbarContainer } from './TopbarContainer/TopbarContainer';