Created
February 15, 2019 11:53
-
-
Save dsc712/7e545d8560f0d1ec04bf682f90cd31a0 to your computer and use it in GitHub Desktop.
VideoList Component
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, { 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