]> git.somenet.org - pub/jan/aic18.git/blob - service-website/src/components/PdfReport.js
Minor code cleanup, added prop types
[pub/jan/aic18.git] / service-website / src / components / PdfReport.js
1 import React from "react";
2 import PropTypes from "prop-types";
3
4 const PdfReport = ({pdfLink, loading}) => {
5     if (pdfLink) {
6         return (
7             <div className="pdf-report">
8                 <a href={pdfLink} target="_blank" rel="noopener noreferrer">Download PDF report</a>
9             </div>
10         );
11     } else if (loading) {
12         return (
13             <div className="spinner">
14                 <div className="rect1 has-background-info"/>
15                 <div className="rect2 has-background-info"/>
16                 <div className="rect3 has-background-info"/>
17                 <div className="rect4 has-background-info"/>
18                 <div className="rect5 has-background-info"/>
19             </div>
20         );
21     } else {
22         return null;
23     }
24 };
25
26 PdfReport.propTypes = {
27     pdfLink: PropTypes.string,
28     loading: PropTypes.bool.isRequired,
29 };
30
31 export default PdfReport;