Created
October 21, 2018 08:07
-
-
Save productioncoder/cb807af40faeeb6af205d0e4b606dd3e to your computer and use it in GitHub Desktop.
Youtube dynamic VideoGrid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './VideoGrid.scss'; | |
import {VideoGridHeader} from "./VideoGridHeader/VideoGridHeader"; | |
import {Divider} from "semantic-ui-react"; | |
import {VideoPreview} from '../VideoPreview/VideoPreview'; | |
export function VideoGrid(props) { | |
if (!props.videos || !props.videos.length) { | |
return <div/>; | |
} | |
const gridItems = props.videos.map(video => { | |
return (<VideoPreview video={video} | |
key={video.id}/>); | |
}); | |
const divider = props.hideDivider ? null : <Divider/>; | |
return ( | |
<React.Fragment> | |
<VideoGridHeader title={props.title}/> | |
<div className='video-grid'> | |
{gridItems} | |
</div> | |
{divider} | |
</React.Fragment> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment