Skip to content

Instantly share code, notes, and snippets.

@dsc712
Created February 15, 2019 11:53
Show Gist options
  • Save dsc712/7e545d8560f0d1ec04bf682f90cd31a0 to your computer and use it in GitHub Desktop.
Save dsc712/7e545d8560f0d1ec04bf682f90cd31a0 to your computer and use it in GitHub Desktop.
VideoList Component
import React, { Component } from 'react';
import VideoListItem from './VideoListItem';
import { List } from 'antd';
class VideoList extends Component {
state = {
data: []
};
render() {
if( this.props.videos.length === 0 ) {
return (
<List
style={{ "width": "40%"}}
size={"large"}
header={<div>Video Suggestions</div>}
bordered
dataSource={ this.state.data }
renderItem={item => (<List.Item>{item}</List.Item>)}
/>
)
}
const videoItems = this.props.videos.map((video, index) => {
return (
<VideoListItem
key={ index }
video={video}
onUserSelected={ this.props.onVideoSelect.bind( this, [ index ]) }
/>
)
});
return (
<ul style={{ "listStyle":"none" ,"width":"40%", "padding": "5px", "border": "1px solid #efefef", "marginBottom": "3px", "borderRadius": "5px" }}>
{ videoItems }
</ul>
);
}
}
export default VideoList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment