Skip to content

Commit

Permalink
Merge pull request COVID19Tracking#1711 from COVID19Tracking/kevee/cl…
Browse files Browse the repository at this point in the history
…eanup-homepage-subtitles

chore: Allow metrics to define a subtitle
  • Loading branch information
kevee authored Jan 4, 2021
2 parents c6e205d + 499ae6f commit c58881a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`Components : Layout : Footer renders correctly 1`] = `
>
<span>
CovidTracking.com Copyright ©
2020
2021
by The Atlantic Monthly Group.
<a
href="/license"
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/components/layout/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Array [
>
<span>
CovidTracking.com Copyright ©
2020
2021
by The Atlantic Monthly Group.
<a
href="/license"
Expand Down Expand Up @@ -1242,7 +1242,7 @@ Array [
>
<span>
CovidTracking.com Copyright ©
2020
2021
by The Atlantic Monthly Group.
<a
href="/license"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const USMap = ({ configuration, item }) => {
relatedPost={item.relatedPost}
title={
<Title title={metrics[metric].title}>
From {sevenDaysAgo} to {lastUpdate}
{metrics[metric].subTitle(lastUpdate, sevenDaysAgo)}
</Title>
}
disclaimer={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const getAverage = (history, state, value) =>
export default {
casesPer100k: {
title: 'Average daily new COVID-19 cases per 100k people (past 7 days)',
subTitle: (now, sevenDaysAgo) => `From ${sevenDaysAgo} to ${now}`,
getValue: (history, state) =>
getAverage(
history,
Expand Down Expand Up @@ -56,6 +57,7 @@ export default {
},
sevenDayPositive: {
title: 'Average daily new COVID-19 cases (past 7 days)',
subTitle: (now, sevenDaysAgo) => `From ${sevenDaysAgo} to ${now}`,
getValue: (history, state) =>
getAverage(history, state.state, item => item.positiveIncrease),

Expand Down Expand Up @@ -96,6 +98,7 @@ export default {
},
hospitalizationPer1m: {
title: 'Currently hospitalized per 1 million people',
subTitle: now => `Data updated ${now}`,
getValue: (history, state) =>
history.find(group => group.nodes[0].state === state.state).nodes[0]
.childPopulation.hospitalizedCurrently.percent * 1000000,
Expand Down

0 comments on commit c58881a

Please sign in to comment.