diff --git a/src/__tests__/components/charts/__snapshots__/bar-chart.js.snap b/src/__tests__/components/charts/__snapshots__/bar-chart.js.snap index ab983b6b1..d9f76d052 100644 --- a/src/__tests__/components/charts/__snapshots__/bar-chart.js.snap +++ b/src/__tests__/components/charts/__snapshots__/bar-chart.js.snap @@ -67,7 +67,7 @@ exports[`Components : Charts: Bar chart renders correctly 1`] = ` viewBox="0 0 200 200" > - + Use arrows to move, Escape to leave. diff --git a/src/components/layout/header/data-warning.js b/src/components/layout/header/data-warning.js index 4ae421886..c1ce62736 100644 --- a/src/components/layout/header/data-warning.js +++ b/src/components/layout/header/data-warning.js @@ -1,4 +1,3 @@ -/* eslint-disable */ import React, { useState, useEffect } from 'react' import { useStaticQuery, graphql } from 'gatsby' import marked from 'marked' diff --git a/src/components/layout/header/index.js b/src/components/layout/header/index.js index 633191cb7..9b8d2fca9 100644 --- a/src/components/layout/header/index.js +++ b/src/components/layout/header/index.js @@ -23,6 +23,7 @@ import HeaderSubNavigation from './sub-navigation' import ReturnLinks from './return-links' import Tools from './tools' import DataWarning from './data-warning' +import RtLiveWarning from './rt-live-warning' const expandStyles = { open: { background: colors.colorPlum800 }, @@ -144,6 +145,7 @@ const Header = withSearch( <> {showWarning && } +
{ + const [isHidden, setIsHidden] = useState(true) + + useEffect(() => { + if (typeof document === 'undefined') { + return + } + if (document.cookie && document.cookie.search('rt_ctp_warning') > -1) { + return + } + if ( + (typeof document.referrer !== 'undefined' && + document.referrer.search('rt.live') > -1) || + window.location.href.search(/\?source=rt/) > -1 + ) { + setIsHidden(false) + } + }, []) + + return ( + <> + {!isHidden && ( +
+ + +

+ Welcome, rt.live users. We are unaffiliated with rt.live and do + not estimate reproduction numbers for COVID-19. We do offer{' '} + + official public health data for 56 US states and territories + {' '} + and a full set of chart tools you + may find helpful. +

+
+
+ )} + + ) +} + +export default DataWarning