Skip to content

Commit

Permalink
Merge pull request COVID19Tracking#176 from COVID19Tracking/add-gatsb…
Browse files Browse the repository at this point in the history
…y-press-js

Add component for press links
  • Loading branch information
kevee authored Mar 25, 2020
2 parents 1447d29 + 535e1a3 commit 9d7960e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/common/press.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import { Link } from 'gatsby'

export const PressList = ({ press }) => (
<ul>
{press.map(({ node }) => (
<li key={`press-${node.id}`}>
<Link to={node.url}>{node.title}</Link>, {node.publication}, {node.publishDate}
</li>
))}
</ul>
)
42 changes: 42 additions & 0 deletions src/stories/12-Press-links.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import { PressList } from '../components/common/press'

export default {
title: 'Press Links',
}

export const regular = () => <PressList press={dummyData.allCovidPress.edges}/>

const dummyData = {
"allCovidPress": {
"edges": [
{
"node": {
"title": "Coronavirus update: 392,870 cases globally, 17,159 deaths, Italy shows glimmer of hope and NYC remains U.S. epicenter",
"url": "https://www.marketwatch.com/story/coronavirus-update-392870-cases-globally-17159-deaths-italy-shows-glimmer-of-hope-and-nyc-remains-us-epicenter-2020-03-24?siteid=yhoof2&yptr=yahoo",
"publishDate": "24 March 2020",
"id": "e0b4614e-ad97-5d0f-9cde-582b88c815ff",
"publication": "MarketWatch"
}
},
{
"node": {
"title": "Comparing COVID-19 in Minnesota and its neighbors in Upper Midwest",
"url": "https://www.mprnews.org/story/2020/03/17/comparing-covid19-in-minnesota-and-its-neighbors-in-upper-midwest",
"publishDate": "23 March 2020",
"id": "72d7dbae-24b3-5253-8a3e-9bbbe54d23f7",
"publication": "Minnesota Public Radio"
}
},
{
"node": {
"title": "Coronavirus cases top 300,000 worldwide as US becomes one of worst hit countries",
"url": "https://www.cnbc.com/2020/03/21/coronavirus-cases-top-300000-worldwide-as-us-becomes-one-of-worst-hit.html",
"publishDate": "21 March 2020",
"id": "a5ecabb4-c79a-58d3-b85e-e54035471d25",
"publication": "CNBC"
}
}
]
}
}

0 comments on commit 9d7960e

Please sign in to comment.