frontend/src/components/RandomTopic.js

40 lines
957 B
JavaScript
Raw Normal View History

import Grid from 'react-css-grid'
2018-12-05 00:49:33 +02:00
import React from 'react';
import PropTypes from 'prop-types';
import VideoItem from "./VideoItem";
import SectionHeading from "./SectionHeading";
2018-12-07 19:35:40 +02:00
import {Link} from 'react-router-dom';
class RandomTopic extends React.Component {
render() {
return (
<section>
2018-12-07 19:35:40 +02:00
<SectionHeading title={this.props.topicName}/>
<Grid
width={450}
gap={16}>
2018-12-07 19:35:40 +02:00
{this.props.videos.map(video =>
<VideoItem id={video.id} title={video.title}/>
)}
2018-12-07 19:35:40 +02:00
<Link to="/topics">
See All Topics
</Link>
<Link to="/topics">
See All videos of {this.props.topicName} ({this.props.topicCount})
2018-12-07 19:35:40 +02:00
</Link>
</Grid>
</section>
)
}
2018-12-05 00:49:33 +02:00
}
RandomTopic.propTypes = {
topicName: PropTypes.string,
videos: PropTypes.array,
loading: PropTypes.bool,
topicCount: PropTypes.number
};
export default (RandomTopic);