Cleaned more code, still untested.

This commit is contained in:
2018-10-24 09:06:18 +11:00
parent 7030a513de
commit f1b10e223e
28 changed files with 183 additions and 313 deletions

View File

@ -22,29 +22,35 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import React from 'react';
import Styles from './VideoSection.scss';
import Section from './../Section';
import Video from '@objects/video/Video';
import Loader from '@objects/loading/Loader';
class VideoSection extends React.Component {
constructor(props) {
super(props);
}
export default (props) => {
let { full, className, sources } = props;
let videoProps = {...props};
let sectionProps = {...props};
render() {
return (
<Section full={this.props.full} className="c-video-section">
<Video
className="c-video-section__video"
autoPlay
loop
fill
sources={ this.props.sources ? this.props.sources : this.props }
/>
{ this.props.children }
</Section>
);
}
[
"autoPlay", "fill", "loop", "sources"
].forEach(e => delete sectionProps[e]);
delete videoProps.children;
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}`:``)}>
<Video {...videoProps} className="c-video-section__video" sources={ sources ? sources : props } />
{ children }
</Section>
);
}
export default VideoSection;

View File

@ -0,0 +1,21 @@
/*
* Video Section
* Styles for Video Sections, usually contains videos.
*
* Dependencies:
* styles/tools/_absolute-centering.scss
*
* Version:
* 1.0.0 - 2018/05/03
*/
@import '~@styles/global';
.c-video-section {
position: relative;
&__video {
@include t-absolute-fill();
object-fit: cover;
object-position: center;
}
}