-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewsCard.js
33 lines (28 loc) · 1.05 KB
/
NewsCard.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import PropTypes from 'prop-types';
import '../../styles/news/NewsCard.css';
const NewsCard = ({ news }) => {
return (
<div className="news-card" onClick={() => window.open(news.rssUrl, '_blank')}>
<div className="news-card-header">
<span className="news-card-source">{news.source}</span>
<span className="news-card-time">{news.publishedAt}</span>
</div>
<div className="news-card-body">
<div className="news-card-text">
<h3 className="news-card-title">{news.title}</h3>
<p className="news-card-description">{news.description}</p>
</div>
{news.coverImageUrl && (
<div className="news-card-icon">
<img src={news.coverImageUrl} alt={news.source} />
</div>
)}
</div>
</div>
);
};
NewsCard.propTypes = {
news: PropTypes.object.isRequired,
};
export default NewsCard;