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

@ -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>