Crunched and clean all the components even more.

This commit is contained in:
2018-10-28 21:48:33 +11:00
parent 21aed1b61f
commit f598a0295c
10 changed files with 59 additions and 87 deletions

View File

@ -25,7 +25,7 @@ import React from 'react';
import Styles from './Section.scss';
export default (props) => {
export default props => {
let newProps = {...props};
let { full, className, children } = props;
@ -35,9 +35,7 @@ export default (props) => {
if(full) clazz += " is-full";
if(className) clazz += ` ${className}`;
return (
<section {...newProps} className={clazz} />
);
return <section {...newProps} className={clazz} />;
}
import BodySection from './body/BodySection';

View File

@ -27,11 +27,4 @@ import Styles from './BodySection.scss';
import Section from './../Section';
export default function(props) {
let clazz = "c-body-section";
if(props.className) clazz += ` ${props.className}`;
return (
<Section {...props} className={clazz} />
);
};
export default props => <Section {...props} className={`c-body-section ${props.className||""}`} />;

View File

@ -27,8 +27,4 @@ import Styles from './ClearSection.scss';
import Section from './../Section';
export default (props) => {
let clazz = "c-clear-section";
if(props.className) clazz += " " + props.className;
return <Section {...props} className={clazz} />;
};
export default props => <Section {...props} className={`c-clear-section ${props.className||""}`} />;

View File

@ -29,31 +29,27 @@ import Section from './../Section';
export default (props) => {
let { align, className } = props;
let newProps = {...props};
align = align || "stretched";
let clazz = "c-split-section is-" + align;
if(className) clazz += ` ${className}`;
return (
<Section {...newProps} className={clazz} />
<Section {...props} className={clazz} />
)
};
const Split = function(props) {
const Split = props => {
let newProps = {...props};
let { padded, className, children } = props;
let clazz = "c-split-section__split";
["padded"].forEach(e => delete newProps[e]);
let clazz = "c-split-section__split";
if(padded) clazz += " is-padded";
if(className) clazz += ` ${className}`;
return (
<div className={clazz}>
{ children }
</div>
);
return <div {...newProps} className={clazz} />;
}

View File

@ -31,24 +31,19 @@ import Video from '@objects/video/Video';
import Loader from '@objects/loading/Loader';
export default (props) => {
let { full, className, sources } = props;
let { full, className, sources, children } = props;
let videoProps = {...props};
let sectionProps = {...props};
[
"autoPlay", "fill", "loop", "sources"
].forEach(e => delete sectionProps[e]);
delete videoProps.children;
[ "autoPlay", "fill", "loop", "sources" ].forEach(e => delete sectionProps[e]);
[ "children" ].forEach(e => delete videoProps[e]);
if(typeof props.autoPlay === typeof undefined) props.autoPlay = true;
if(typeof props.loop === typeof undefined) props.loop = true;
if(typeof props.fill === typeof undefined) props.fill = true;
return (
<Section {...sectionProps} className={"c-video-section"+(className?` ${className}`:``)}>
<Section {...sectionProps} className={`c-video-section ${className|""}`}>
<Video {...videoProps} className="c-video-section__video" sources={ sources ? sources : props } />
{ children }
</Section>