37 lines
927 B
JavaScript
Raw Normal View History

import React from 'react';
2018-07-17 15:07:27 +02:00
import Parser from 'html-react-parser';
import { PropTypes } from 'prop-types';
import './style.scss';
2018-07-13 14:02:09 +02:00
const RelatedInterviewsList = (props) => {
if (!props.data || props.data[0] === null) {
return <div>Loading...</div>;
} else if (props.data.length < 1) {
2018-07-16 09:22:42 +02:00
return <div>No results found</div>;
2018-07-13 14:02:09 +02:00
}
return (
<div className="related-interviews-list">
2018-07-17 15:07:27 +02:00
<h5>Related <br />Interviews</h5>
2018-07-13 14:02:09 +02:00
<ul>
{ props.data.map(interview => (
<li
id={interview.id}
key={interview.id}
>
2018-07-17 15:07:27 +02:00
<button onClick={props.toggleSingleInterview}>{ Parser(interview.name) }</button>
2018-07-13 14:02:09 +02:00
</li>
))
}
</ul>
</div>
);
};
RelatedInterviewsList.propTypes = {
2018-07-09 16:29:38 +02:00
data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
toggleSingleInterview: PropTypes.func.isRequired,
2018-07-06 14:36:22 +02:00
};
export default RelatedInterviewsList;