74 lines
No EOL
2.3 KiB
JavaScript
74 lines
No EOL
2.3 KiB
JavaScript
import Grid from 'react-css-grid'
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import VideoItem from "./VideoItem";
|
|
import RandomItemTitle from "./SectionHeading";
|
|
import {Link} from 'react-router-dom';
|
|
|
|
// Refactor
|
|
class RandomTopic extends React.Component {
|
|
|
|
shuffleTopic() {
|
|
this.props.getRandomTopicVideos(this.props.allTopics);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<section className="random-item-container">
|
|
<h2 className="section-heading">
|
|
<span className="arabic-text random-section-title">من مواضيع الارشيف</span>
|
|
<br/>
|
|
{/*<span className="english-text bold-english-text">topics from the Archive </span>*/}
|
|
<span className="section-title">
|
|
<span className='english-text bold-english-text random-section-title'> topics from the archive
|
|
</span>
|
|
</span>
|
|
</h2>
|
|
|
|
<Grid
|
|
className={"buttons-grid"}
|
|
width={450}
|
|
>
|
|
{/* View all topics button*/}
|
|
<Link className="view-items-link" to="/topics">
|
|
<button className="view-all-items">
|
|
<span className="english-text"> all topics </span>
|
|
<span className="arabic-text"> جميع المواضيع </span>
|
|
</button>
|
|
</Link>
|
|
{/* Shuffle button */}
|
|
<button className="shuffle-button" onClick={this.shuffleTopic.bind(this)}>
|
|
<span className="arabic-text"> موضوع عشوائي </span>
|
|
<span className="english-text"> shuffle topics </span>
|
|
|
|
<i className="fa fa-random"></i>
|
|
</button>
|
|
</Grid>
|
|
|
|
<Grid className="random-topics"
|
|
width={220}
|
|
gap={12}>
|
|
{this.props.videos.map(video =>
|
|
<VideoItem id={video.id} key={video.id} title={video.title}/>
|
|
)}
|
|
</Grid>
|
|
<RandomItemTitle title={this.props.topicName}
|
|
count={this.props.topicCount}
|
|
src={'/results/topic/' + this.props.topicName}
|
|
/>
|
|
</section>
|
|
|
|
)
|
|
}
|
|
}
|
|
|
|
RandomTopic.propTypes = {
|
|
topicName: PropTypes.string,
|
|
allTopics: PropTypes.array,
|
|
videos: PropTypes.array,
|
|
loading: PropTypes.bool,
|
|
topicCount: PropTypes.number,
|
|
getRandomTopicVideos: PropTypes.func
|
|
};
|
|
|
|
export default (RandomTopic); |