Fixed some objects that don't like the new props.

This commit is contained in:
2018-10-25 07:31:11 +11:00
parent 37114b2ad6
commit 88e0d6f4ab
6 changed files with 88 additions and 88 deletions

View File

@ -29,17 +29,16 @@ import { HashRouter, Route, Switch } from 'react-router-dom';
import Loadable from 'react-loadable';
const PageLoading = (props) => {
if(props.error) return <span>Loading Error</span>;
if(props.pastDelay) return <span>Loading...</span>;
let { error, pastDelay } = props;
if(error) return <span>Loading Error</span>;
if(pastDelay) return <span>Loading...</span>;
return null;
};
export const RouteWrapper = (props) => {
let { page } = props.page;
let render = () => {
let CustomLoadable = Loadable({
loader: page,
loader: props.page,
loading: PageLoading
});
return <CustomLoadable />
@ -49,7 +48,7 @@ export const RouteWrapper = (props) => {
};
export default withRouter((props) => {
const { match, location, history, children } = this.props;
const { match, location, history, children } = props;
return (
<Route>

View File

@ -28,36 +28,27 @@ import Section from './../Section';
import Image from '@objects/image/Image';
export default function(props) {
let image;
export default props => {
let sectionProps = {...props};
let imageProps = {...props};
let { image, background, children, className } = props;
["children", "background", "loadable"].forEach(e => delete sectionProps[e]);
["image", "full", "children", "background"].forEach(e => delete imageProps[e]);
let clazz = "c-image-section";
image = image || <Image {...imageProps} className="c-image-section__image" />;
if(props.image) {
image = props.image;
} else {
image = <Image
{...props}
children={null}
className="c-image-section__image"
/>;
}
if(props.className) clazz += " " + props.className;
if(props.background) {
//Background Image Effect
clazz += " is-background";
}
if(className) clazz += ` ${className}`;
if(background) clazz += " is-background";
return (
<Section
full={props.full}
className={ clazz }
>
<Section {...sectionProps} className={ clazz }>
{ image }
<div className="c-image-section__content">
<div className="c-image-section__content-inner">
{ props.children }
{ children }
</div>
</div>
</Section>