Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created October 21, 2018 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/cb807af40faeeb6af205d0e4b606dd3e to your computer and use it in GitHub Desktop.
Save productioncoder/cb807af40faeeb6af205d0e4b606dd3e to your computer and use it in GitHub Desktop.
Youtube dynamic VideoGrid
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