diff --git a/README.md b/README.md index 1918a1666a..4f2a893f48 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ npm i && npm start ``` - ## Contribution If you're new to contributing to Open Source on Github, [this guide](https://guides.github.com/activities/contributing-to-open-source/) can help you get started. Please check out the [contribution guide](CONTRIBUTING.md) for more details on how issues and pull requests work. diff --git a/package-lock.json b/package-lock.json index 85324229df..aecb69d6f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2257,11 +2257,6 @@ } } }, - "@use-it/event-listener": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@use-it/event-listener/-/event-listener-0.1.3.tgz", - "integrity": "sha512-UCHkLOVU+xj3/1R8jXz8GzDTowkzfIDPESOBlVC2ndgwUSBEqiFdwCoUEs2lcGhJOOiEdmWxF+T23C5+60eEew==" - }, "@webassemblyjs/ast": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", @@ -6693,6 +6688,11 @@ "strip-eof": "^1.0.0" } }, + "exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=" + }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -14800,6 +14800,41 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "react-is-visible": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/react-is-visible/-/react-is-visible-1.1.0.tgz", + "integrity": "sha512-vq9EqTEZ9fEyW1C33Yuj1cNDbamnJEZfQCIPOGNxVKUMaG95XkVaANMecRkQHl33aGzCpPMFIkt6A69xJOuiQA==", + "requires": { + "@babel/runtime": "^7.4.4", + "hoist-non-react-statics": "3.3.0" + }, + "dependencies": { + "hoist-non-react-statics": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz", + "integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==", + "requires": { + "react-is": "^16.7.0" + } + } + } + }, + "react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, + "react-modal": { + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.11.2.tgz", + "integrity": "sha512-o8gvvCOFaG1T7W6JUvsYjRjMVToLZgLIsi5kdhFIQCtHxDkA47LznX62j+l6YQkpXDbvQegsDyxe/+JJsFQN7w==", + "requires": { + "exenv": "^1.2.0", + "prop-types": "^15.5.10", + "react-lifecycles-compat": "^3.0.0", + "warning": "^4.0.3" + } + }, "react-router": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz", @@ -18574,23 +18609,6 @@ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, - "use-dark-mode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/use-dark-mode/-/use-dark-mode-2.3.1.tgz", - "integrity": "sha512-hmcdJR96tTustRQdaQwe6jMrZHnmPqXBxgy4jaQ4gsfhwajsCpjECuq9prgDe9XxMx/f9r96o2/md6O4Lwhwjg==", - "requires": { - "@use-it/event-listener": "^0.1.2", - "use-persisted-state": "^0.3.0" - } - }, - "use-persisted-state": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/use-persisted-state/-/use-persisted-state-0.3.0.tgz", - "integrity": "sha512-UlWEq0JYg7NbvcRBZ1g6Bwe4SEbYfr1wr/D5mrmfCzSxXSwsPRYygGLlsxHcW58Rf7gGwRPBT23sNVvyVn4WYg==", - "requires": { - "@use-it/event-listener": "^0.1.2" - } - }, "user-home": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", @@ -18721,6 +18739,14 @@ "makeerror": "1.0.x" } }, + "warning": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "requires": { + "loose-envify": "^1.0.0" + } + }, "watchpack": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz", diff --git a/package.json b/package.json index dcc083ad64..b37e48c3f9 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "react-content-loader": "^5.1.0", "react-dom": "^16.13.1", "react-feather": "^2.0.8", + "react-is-visible": "^1.1.0", + "react-modal": "^3.11.2", "react-helmet": "^6.1.0", "react-i18next": "^11.7.0", "react-router-dom": "^5.2.0", @@ -46,7 +48,6 @@ "source-map-explorer": "^2.4.2", "swr": "^0.2.3", "topojson": "^3.0.2", - "use-dark-mode": "^2.3.1", "workerize-loader": "^1.3.0" }, "scripts": { diff --git a/src/App.js b/src/App.js index b4c9a701cf..6efb26cc58 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,84 @@ import './App.scss'; +import './dark-theme.scss'; + import Blog from './components/Blog'; import Navbar from './components/Navbar'; +import ThemeChooser from './components/themechooser'; +import {PRIMARY_COLORS, BACKGROUND_COLORS} from './constants'; -import React, {lazy, useState, Suspense} from 'react'; +import React, {lazy, useState, Suspense, useEffect, useCallback} from 'react'; import {Route, Redirect, Switch, useLocation} from 'react-router-dom'; -import useDarkMode from 'use-dark-mode'; const Home = lazy(() => import('./components/Home')); const About = lazy(() => import('./components/About')); const State = lazy(() => import('./components/State')); const LanguageSwitcher = lazy(() => import('./components/LanguageSwitcher')); +const colorKeys = Object.freeze({ + P_COLOR: 'p-color', + BG_COLOR: 'bg-color', +}); + const App = () => { - const darkMode = useDarkMode(false); const [showLanguageSwitcher, setShowLanguageSwitcher] = useState(false); const location = useLocation(); + const [showThemeChooser, setShowThemeChooser] = useState(false); + const [pColor, setPColor] = useState(''); + const [bgColor, setBgColor] = useState(''); + + useEffect(() => { + const cachedPColor = + localStorage?.getItem(colorKeys.P_COLOR) ?? PRIMARY_COLORS[0]; + const cachedBgColor = + localStorage?.getItem(colorKeys.BG_COLOR) ?? + BACKGROUND_COLORS.DEFAULT.color; + + setPColor(cachedPColor); + setBgColor(cachedBgColor); + }, []); + + useEffect(() => { + const root = document.documentElement; + root.style.setProperty('--primary-color', pColor); + }, [pColor]); + + useEffect(() => { + const root = document.documentElement; + root.style.setProperty('--background-color', bgColor); + let className; + + if (bgColor === BACKGROUND_COLORS.LIGHTS_OUT.color) { + className = 'dark-mode dim'; + } else if (bgColor === BACKGROUND_COLORS.DIM.color) { + className = 'dark-mode lights-out'; + } else { + className = 'light-theme'; + } + + document.getElementsByTagName('body')[0].className = className; + }, [bgColor]); + + const cacheColor = (key, color) => { + localStorage.setItem(key, color); + }; + + const handleOnPColorChange = useCallback( + (newColor) => { + setPColor(newColor); + cacheColor(colorKeys.P_COLOR, newColor); + }, + [setPColor] + ); + + const handleOnBgColorChange = useCallback( + (newColor) => { + setBgColor(newColor); + cacheColor(colorKeys.BG_COLOR, newColor); + }, + [setBgColor] + ); + const pages = [ { pageLink: '/', @@ -44,35 +107,46 @@ const App = () => { ]; return ( -
- }> - + {showThemeChooser && ( + setShowThemeChooser(false)} + onPColorChange={handleOnPColorChange} + onBgColorChange={handleOnBgColorChange} + {...{pColor, bgColor}} + /> + )} +
+ }> + + + + - - - - - }> - - {pages.map((page, index) => { - return ( - } - key={index} - /> - ); - })} - - - -
+ + }> + + {pages.map((page, index) => { + return ( + } + key={index} + /> + ); + })} + + + +
+ ); }; diff --git a/src/App.scss b/src/App.scss index 38e6b72fc3..344f2c9ec5 100644 --- a/src/App.scss +++ b/src/App.scss @@ -76,6 +76,17 @@ $dark-m-purple-light: #40008050; font-family: 'archia'; } +@mixin root-prop($prop: null, $value: null) { + @if ($prop and $value) { + #{$prop}: $value; + } +} + +:root { + @include root-prop(--primary-color, $pblue); + @include root-prop(--background-color, #fff); +} + html { overflow-x: hidden; width: 100vw; @@ -171,7 +182,7 @@ h6 { text-transform: uppercase; span { - color: $pblue; + color: var(--primary-color); } } @@ -216,7 +227,7 @@ h6 { span { &.focused { background: $pblue-light; - color: $pblue; + color: var(--primary-color); padding: 0.25rem; } } @@ -230,6 +241,7 @@ h6 { justify-content: center; h5 { + color: var(--primary-color); margin: 0; } @@ -289,7 +301,7 @@ h6 { } .alert-right { - margin-left: .25rem; + margin-left: 0.25rem; text-align: right; width: 5rem; @@ -347,7 +359,7 @@ h6 { h5 { color: $gray; font-weight: 600; - margin-top: .5rem; + margin-top: 0.5rem; } } @@ -679,14 +691,14 @@ h6 { background: $brick-light; border-radius: 5px; cursor: pointer; - padding: .25rem; + padding: 0.25rem; } .dropdown { background: $white; border-radius: 5px; height: 25rem; - left: -.25rem; + left: -0.25rem; overflow-y: scroll; position: absolute; top: 2.75rem; @@ -732,8 +744,8 @@ h6 { flex-direction: row; font-size: 14px; margin-bottom: 0.25rem; - margin-right: .25rem; - padding: .25rem .5rem; + margin-right: 0.25rem; + padding: 0.25rem 0.5rem; text-transform: capitalize; &.is-selected { @@ -911,8 +923,8 @@ h6 { border-radius: 5px; color: $pink; cursor: pointer; - font-size: .75rem; - padding: .75rem; + font-size: 0.75rem; + padding: 0.75rem; text-align: center; } @@ -937,7 +949,7 @@ h6 { } h3 { - color: $pblue; + color: var(--primary-color); margin-bottom: 0.75rem; } } @@ -1099,7 +1111,7 @@ h6 { .result-description { align-self: flex-start; font-size: 0.75rem; - margin-bottom: .5rem; + margin-bottom: 0.5rem; margin-top: 1rem; } @@ -1119,7 +1131,7 @@ h6 { flex-direction: row; font-size: 0.75rem; height: 1rem; - margin-right: .25rem; + margin-right: 0.25rem; margin-top: 0.25rem; padding: 0.25rem; text-align: right; @@ -1155,7 +1167,7 @@ h6 { color: $gray-mid; display: flex; flex-direction: row; - padding: .1rem; + padding: 0.1rem; div { padding-top: 1px; @@ -1260,7 +1272,7 @@ h6 { position: relative; .indicator { - background: $pblue; + background: var(--primary-color); border-radius: 50%; height: 7px; position: absolute; @@ -1498,7 +1510,7 @@ abbr { } .TableLoader { - margin-bottom: -.25rem; + margin-bottom: -0.25rem; } .table-top { @@ -1508,7 +1520,7 @@ abbr { flex-direction: row; font-weight: 600; justify-content: space-between; - margin-bottom: .25rem; + margin-bottom: 0.25rem; width: calc(100% - 2rem); .option-toggle, @@ -1518,12 +1530,12 @@ abbr { border-radius: 5px; color: $gray-mid; cursor: pointer; - margin-right: .25rem; - padding: .5rem; + margin-right: 0.25rem; + padding: 0.5rem; svg { align-self: center; - margin: .25rem; + margin: 0.25rem; } &.is-highlighted { @@ -1609,7 +1621,7 @@ abbr { svg { color: $gray-mid; - margin-bottom: .25rem; + margin-bottom: 0.25rem; } .is-confirmed { @@ -1694,13 +1706,13 @@ abbr { flex-wrap: wrap; justify-content: space-between; left: 0; - margin-bottom: 1 + .25rem; + margin-bottom: 1 + 0.25rem; margin-top: 1rem; position: sticky; width: 30rem; svg { - margin-right: .5rem; + margin-right: 0.5rem; } .last-updated { @@ -1718,7 +1730,7 @@ abbr { cursor: pointer; display: flex; flex-direction: row; - padding: .75rem; + padding: 0.75rem; p { align-self: flex-end; @@ -1744,7 +1756,7 @@ abbr { border-radius: 5px; color: $brick; margin: auto; - padding: 1rem .25rem; + padding: 1rem 0.25rem; text-align: center; width: 50%; @@ -1802,8 +1814,8 @@ abbr { color: $gray; display: flex; flex-direction: row; - margin-bottom: .25rem; - padding: .5rem; + margin-bottom: 0.25rem; + padding: 0.5rem; position: relative; &:not(:first-child) { @@ -1836,8 +1848,8 @@ abbr { .sort-icon { left: 0; - margin-left: .25rem; - margin-right: .25rem; + margin-left: 0.25rem; + margin-right: 0.25rem; position: absolute; top: 0; @@ -1872,7 +1884,7 @@ abbr { } &.invert { - margin-top: .25rem; + margin-top: 0.25rem; transform: rotate(180deg); } } @@ -1912,7 +1924,7 @@ abbr { background: $gray-light-opaque; font-size: 13px; font-weight: 900; - padding: .75rem .5rem; + padding: 0.75rem 0.5rem; &:hover { background: $gray-hover-opaque !important; @@ -1932,7 +1944,7 @@ abbr { .spacer { color: $gray-mid; left: 0; - margin-bottom: 1 + .25rem; + margin-bottom: 1 + 0.25rem; margin-top: 1rem; position: sticky; text-align: center; @@ -2228,11 +2240,11 @@ abbr { } .switch-type, - .switch-statistic, { + .switch-statistic { display: flex; flex-direction: row; justify-content: flex-end; - margin-bottom: .25rem; + margin-bottom: 0.25rem; div { align-items: center; @@ -2259,7 +2271,7 @@ abbr { } &:not(:last-child) { - margin-right: .25rem; + margin-right: 0.25rem; } svg { @@ -2284,8 +2296,8 @@ abbr { display: flex; flex-direction: row; height: 1.25rem; - margin-bottom: .25rem; - margin-left: .65rem !important; + margin-bottom: 0.25rem; + margin-left: 0.65rem !important; width: 1.25rem; span { @@ -3063,11 +3075,16 @@ footer { color: $gray; font-weight: 600; margin: 0; + } + + .moto { + border-color: var(--primary-color); margin-bottom: 3.5rem; + width: 10%; } svg { - padding: .25rem; + padding: 0.25rem; } .github { @@ -3201,7 +3218,7 @@ footer { width: 100%; h2 { - color: $pblue; + color: var(--primary-color); font-weight: 900; } } @@ -3243,7 +3260,7 @@ footer { .button { background: $pblue-light; - color: $pblue; + color: var(--primary-color); display: flex; flex-direction: row; height: 3rem; @@ -3467,7 +3484,7 @@ footer { h3 { align-self: center; - color: $pblue; + color: var(--primary-color); font-weight: 600; margin-bottom: 2rem; } @@ -3493,7 +3510,7 @@ footer { stroke-width: 2.5px; &:hover { - color: $pblue; + color: var(--primary-color); } } } @@ -3518,12 +3535,12 @@ footer { user-select: none; &:hover { - color: $pblue; + color: var(--primary-color); } &.is-highlighted { background: $pblue-light; - color: $pblue; + color: var(--primary-color); } } } @@ -3547,7 +3564,7 @@ footer { justify-content: flex-end; max-width: 30vw; min-width: 10rem; - padding: .5rem; + padding: 0.5rem; pointer-events: none; right: 0; top: 0; @@ -3576,7 +3593,7 @@ footer { z-index: 999; .navbar-left { - margin-bottom: .5rem; + margin-bottom: 0.5rem; margin-top: auto; order: 3; text-align: center; @@ -3632,14 +3649,6 @@ footer { } } } - - .dark-mode { - .Navbar, - .expand, - .navbar-right { - background: #1e1e30 !important; - } - } } @media (max-width: 769px) { @@ -3666,7 +3675,7 @@ footer { } .Home, - .State, { + .State { display: flex; flex-direction: column; margin-left: 0; @@ -3754,7 +3763,7 @@ footer { } .cards-container { - padding: .5rem; + padding: 0.5rem; .cards { .card { @@ -3919,346 +3928,6 @@ footer { } } -// Dark Mode - -.dark-mode { - background: #161625 !important; - color: #bdbdbd; - - .switch-wrapper > div { - background: #161625 !important; - } - - .is-tested { - color: $dark-m-purple !important; - - svg { - color: $dark-m-purple !important; - } - } - - .expand { - background: #1e1e30 !important; - } - - .Navbar, - .expand { - border-right: 0; - - .navbar-middle { - color: #bdbdbd; - } - } - - .table { - .cell { - &:first-child { - background: #1e1e30 !important; - } - - &.heading { - background: #1e1e30 !important; - - &:hover { - background: #212130 !important; - } - } - } - - .is-highlighted, - .is-total { - .cell { - background: #1e1e30 !important; - } - } - } - - .Search { - input { - background: #1e1e30 !important; - } - } - - .State { - .header-right { - h5 { - color: #9673b9bb !important; - } - - h2 { - color: #9673b9 !important; - } - - a { - background: $dark-m-purple-light !important; - } - } - - .breadcrumb { - ul { - background: #1e1e30 !important; - - &::after { - border-bottom-color: #1e1e30 !important; - } - - li { - a { - color: $gray !important; - - &:hover { - color: $white !important; - } - } - } - } - } - } - - .StateHeader { - .header-right { - color: $dark-m-purple-mid; - - h2 { - color: $dark-m-purple; - } - - a { - background: $dark-m-purple-light; - } - } - } - - .MapExplorer { - #chart, - #legend { - &.zone { - filter: none; - } - - &:not(.zone) { - filter: invert(1) hue-rotate(180deg) saturate(1.5) url('#balance-color'); - } - } - - .maplegend { - background: #161625 !important; - } - - .meta { - h1 { - &.tested { - color: #9673b9 !important; - } - } - - h2 { - &.tested { - color: #9673b9 !important; - } - } - } - - .stats { - &.tested { - background: $dark-m-purple-light !important; - - h1 { - color: #9673b9 !important; - } - - h5, - h6 { - color: #9673b9bb !important; - } - - svg { - stroke: #9673b9bb !important; - - &:hover { - stroke: #9673b9 !important; - } - } - } - } - - .disclaimer { - color: $gray-light-opaque; - } - } - - .Timeseries, - .Minigraph { - .stats { - &.is-tested { - h5 { - color: $dark-m-purple-mid !important; - - &.title { - color: $dark-m-purple-mid !important; - } - } - - h2, - h6 { - color: $dark-m-purple !important; - } - } - } - - .svg-parent { - &.is-tested { - background: $dark-m-purple-light !important; - - svg { - circle, - .domain, - .tick { - stroke: $dark-m-purple !important; - } - - circle { - fill: $dark-m-purple !important; - } - - .trend, - line { - stroke: #9673b999 !important; - } - - text { - color: $dark-m-purple-mid !important; - stroke: transparent; - } - } - } - } - } - - .tpm { - background: $dark-m-purple-light !important; - - h3, - h5, - svg, - p { - color: #9673b9bb !important; - } - - h1 { - color: #9673b9 !important; - } - } - - .tab { - &.focused { - background: #1e1e30 !important; - color: #bdbdbd !important; - } - } - - .pills { - button { - &.selected { - background: #{$yellow}50; - } - } - } - - .TimeseriesExplorer { - .state-selection { - .dropdown { - select { - background: #1e1e30; - background-image: linear-gradient(45deg, transparent 50%, $gray 50%), - linear-gradient(135deg, $gray 50%, transparent 50%); - background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; - background-repeat: no-repeat; - background-size: 5px 5px, 5px 5px; - border-color: #9494941a; - } - } - } - } - - input { - &.switch { - background-color: #161625 !important; - border: 2px solid $gray-mid !important; - - &:checked { - background-color: #6c757d99 !important; - - &::after { - background-color: #cfcfcf !important; - } - } - - &::after { - background-color: #cfcfcf !important; - } - } - } - - .disabled { - input { - &.switch { - background: $dark !important; - border: $gray-light 2px solid !important; - opacity: 0.7; - - &::after { - background: $gray !important; - } - } - } - } - - .About { - .question { - color: $gray !important; - } - } - - .Demographics { - .filters { - background: #1e1e30 !important; - box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.12), inset 0 -1px 0 0 #1e1e30; - } - - .legend { - background: #1e1e30 !important; - } - - .react-date-picker { - background: #1e1e30; - border-color: #9494941a !important; - } - - .modal-content { - background: #1e1e30 !important; - } - - .modal { - background: #1e1e30bb !important; - } - } - - .StateDropdown { - .dropdown { - background: #1e1e30 !important; - } - } - - .TableLoader { - svg { - rect { - fill: #1e1e30 !important; - } - } - } -} - // Animation Support .fadeInUp { @@ -4320,3 +3989,87 @@ footer { transform: translateY(20px); } } + +.ReactModal__Overlay--after-open { + z-index: 99999; +} + +.theme-chooser-modal { + align-items: center; + display: flex; + flex-direction: column; + width: 100%; + + .title { + font-family: 'archia'; + text-align: center; + } + + .done-btn { + background: var(--primary-color); + border-radius: 12px; + color: #000; + cursor: pointer; + font-family: 'archia'; + margin-top: 16px; + padding: 12px; + text-align: center; + } + + .color-chooser { + margin-top: 16px; + + .title { + font-family: 'archia'; + } + + .colors { + background: rgb(245, 248, 250); + cursor: pointer; + display: flex; + flex: 1; + flex-wrap: wrap; + height: 20%; + justify-content: center; + margin-top: 8px; + + .circle { + align-items: center; + border-radius: 50%; + display: flex; + height: 50px; + justify-content: center; + margin: 8px; + width: 50px; + + .checked-icon { + color: #000; + } + + .selected { + fill: var(--primary-color); + } + + &:hover { + transform: scale(1.1); + transition-duration: 0.2s; + } + } + + .outlined { + border-radius: 4px; + justify-content: space-evenly; + width: 30%; + + .bg-color-name { + color: #fff; + font-family: 'archia'; + } + + .light { + color: #000 !important; + } + } + } + } +} diff --git a/src/components/Footer.js b/src/components/Footer.js index 56be4eab76..c8a978b1e6 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -18,6 +18,7 @@ function Footer(props) {
{t('We stand with everyone fighting on the frontlines')}
+
- {windowSize.width > 768 && } + + {windowSize.width > 768 && } + )}
@@ -95,7 +97,7 @@ function Navbar({ {transitions.map(({item, key, props}) => item ? ( - + ) : ( @@ -105,7 +107,7 @@ function Navbar({ ); } -function Expand({pages, setExpand, darkMode, windowSize}) { +function Expand({pages, setExpand, setShowThemeChooser, windowSize}) { const expandElement = useRef(null); const {t} = useTranslation(); @@ -134,7 +136,7 @@ function Expand({pages, setExpand, darkMode, windowSize}) { return null; })} - {windowSize.width < 768 && } + {windowSize.width < 768 && }
{t('A crowdsourced initiative.')}
@@ -151,15 +153,20 @@ const navLinkProps = (path, animationDelay) => ({ const activeNavIcon = (path) => ({ style: { - stroke: window.location.pathname === path ? '#4c75f2' : '', + stroke: window.location.pathname === path ? 'var(--primary-color)' : '', }, }); -const SunMoon = ({darkMode}) => { +const SunMoon = ({setShowThemeChooser}) => { return ( -
+
{ + setShowThemeChooser(true); + }} + >
- {darkMode.value ? : } +
); diff --git a/src/components/Timeline.js b/src/components/Timeline.js index 93279e1b75..21646b26bc 100644 --- a/src/components/Timeline.js +++ b/src/components/Timeline.js @@ -14,7 +14,7 @@ const Timeline = ({setIsTimelineMode, setDate, dates}) => { dates.length, (i) => ({ x: (index - i) * (480 / 3) + 480 / 2 - 35, - color: i === 0 ? '#6c757d' : '#6c757d99', + color: i === 0 ? '#ababab' : '#abababdd', opacity: i < 2 ? 1 : 0, }), config.stiff diff --git a/src/components/themechooser.js b/src/components/themechooser.js new file mode 100644 index 0000000000..991f441a85 --- /dev/null +++ b/src/components/themechooser.js @@ -0,0 +1,91 @@ +import {PRIMARY_COLORS, BACKGROUND_COLORS} from '../constants'; + +import {CheckCircleIcon} from '@primer/octicons-v2-react'; +import React from 'react'; +import Modal from 'react-modal'; + +const customStyles = { + content: { + top: '50%', + left: '50%', + right: 'auto', + bottom: 'auto', + marginRight: '-50%', + transform: 'translate(-50%, -50%)', + background: 'var(--background-color)', + alignItems: 'flex-start', + display: 'flex', + flexDirection: 'column', + }, +}; + +Modal.setAppElement(document.getElementById('root-app')); + +const ThemeChooser = ({ + isOpen, + onClose, + pColor, + bgColor, + onPColorChange, + onBgColorChange, +}) => ( + +
+

Customise your view

+
+ Colors +
+ {PRIMARY_COLORS.map((color, idx) => ( +
onPColorChange(color)} + style={{background: color}} + > + {pColor === color && ( + + )} +
+ ))} +
+
+ Background +
+ {Object.keys(BACKGROUND_COLORS).map((colorKey, idx) => { + const {color, name} = BACKGROUND_COLORS[colorKey]; + const isDefault = color === BACKGROUND_COLORS.DEFAULT.color; + const isSelected = color === bgColor; + + return ( +
onBgColorChange(color)} + style={{ + background: color, + border: isSelected ? '1px solid var(--primary-color)' : '', + }} + > + {isSelected && ( + + )} + + {name} + +
+ ); + })} +
+
+
+ + Done + +
+
+); + +export default ThemeChooser; diff --git a/src/constants.js b/src/constants.js index f0cd8ce6c9..d611345fe5 100644 --- a/src/constants.js +++ b/src/constants.js @@ -281,3 +281,27 @@ Object.keys(STATE_NAMES).map((key, index) => { }); export const STATE_CODES = stateCodesMap; export const STATE_CODES_ARRAY = stateCodes; + +export const BACKGROUND_COLORS = Object.freeze({ + DEFAULT: { + name: 'Default', + color: '#FFF', + }, + DIM: { + name: 'Dim', + color: '#1B1F23', + }, + LIGHTS_OUT: { + name: 'Lights out', + color: '#000', + }, +}); + +export const PRIMARY_COLORS = Object.freeze([ + 'rgb(29, 161, 242)', + 'rgb(255, 173, 31)', + '#E43f5A', + 'rgb(121, 75, 196)', + 'rgb(255, 127, 80)', + '#17b794', +]); diff --git a/src/dark-theme.scss b/src/dark-theme.scss new file mode 100644 index 0000000000..fbe51bfaa3 --- /dev/null +++ b/src/dark-theme.scss @@ -0,0 +1,2481 @@ +$blue: #007bff; +$blue-light: #007bff10; +$blue-hover: #007bff30; +$blue-light-opaque: #eff7ff; +$blue-mid: #007bffdd; +$pblue: #4c75f2; +$pblue-light: #4c75f230; +$pblue-hover: #4c75f250; +$pblue-light-opaque: #eff7ff; +$pblue-mid: #4c75f299; +$cherry: #ff073a; +$cherry-mid: #ff073add; +$cherry-light: #ff073a20; +$cherry-hover: #ff073a30; +$cherry-light-opaque: #ffe0e6; +$red: #dc3545; +$red-light: #dc354520; +$red-mid: #dc354599; +$red-hover: #dc354530; +$orange: #fd7e14; +$orange-mid: #fd7e1499; +$orange-light: #fd7e1420; +$orange-hover: #fd7e1430; +$orange-light-opaque: #ffefe2; +$yellow: #ffc107; +$yellow-light: #ffc10720; +$yellow-hover: #ffc10730; +$yellow-mid: #ffc107dd; +$yellow-light-opaque: #fff7e0; +$green: #28a745; +$green-light: #28a74520; +$green-hover: #28a74530; +$green-mid: #28a745dd; +$teal: #20c997; +$cyan: #17a2b8; +$white: #fff; +$gray: #ababab; +$gray-light: #ababab10; +$gray-light-opaque: var(--background-color); +$gray-hover: #ababab20; +$gray-mid: #abababdd; +$gray-dark: #343a40; +$gray-opaque: #f0ffff; +$light: #f8f9fa; +$dark: #343a40; +$purple: #9370dbdd; +$purple-light: #9370db20; +$purple-hover: #9370db30; +$purple-mid: #9370db99; +$purple-light-opaque: #e3e2f3; +$pink: #fb5581; +$pink-light: #ffa8cb30; +$pink-hover: #ffa8cb60; +$pink-mid: #fb558199; +$brown: #b6854d; +$brown-light: #b6854d10; +$brown-hover: #b6854d30; +$brown-mid: #b6854ddd; +$brick: #e23028; +$brick-light: #e2302810; +$gray-hover-darker-opaque: #1a1a1a20; +$gray-hover-opaque: #edeeef20; + +$default-primary: var(--primary-color); + +.dark-mode { + background-color: var(--background-color); + color: #fff; + + .dark-hotspot-border > path { + stroke: #f0ffffaa; + } + + .arrow-up { + border-bottom: 5px solid $gray-mid; + } + + .arrow-down { + border-top: 5px solid $gray-mid; + } + + .Navbar { + .navbar-left { + color: $gray-mid; + + &:hover { + color: $gray; + } + } + + .navbar-middle { + color: $gray; + + span { + color: var(--primary-color); + } + } + + .navbar-right { + color: $gray-mid; + + &:hover { + color: $gray; + } + } + + .expand { + background: var(--background-color); + color: $gray; + + & > * { + border: 0; + + &:hover { + background: $gray-hover; + } + + span { + &.focused { + background: none !important; + color: var(--primary-color); + } + } + } + + .expand-bottom { + &:hover { + background: none; + } + } + } + } + + .alert { + background: $gray-light; + color: $gray; + + svg { + color: $gray-mid; + } + + .alert-right { + a { + background: $gray-light; + color: $gray; + + &:hover { + background: $gray-hover; + } + } + } + + &.is-green { + background: $green-light; + color: $green; + + svg { + stroke: $green-mid; + } + } + } + + .TimeseriesExplorer { + .state-selection { + .dropdown { + select { + background-color: var(--background-color); + background-image: url('data:image/svg+xml,'); + border-color: $gray-dark; + color: $gray-opaque; + } + } + } + } + + .state-selection { + color: $brick; + + .reset-icon { + svg { + color: $gray-mid; + fill: #a6abb0; + stroke: #a6abb0; + + &:hover { + fill: $gray; + stroke: $gray; + } + } + } + } + + .StateHeader { + .header-left { + h1 { + color: $brick; + max-width: 20rem; + } + + h5 { + color: $gray; + } + } + + .header-right { + color: $purple-mid; + + h2 { + color: $purple; + font-weight: 900; + } + + a { + background: $purple-light; + + &:hover { + background: $purple-hover; + } + } + } + + .to-essentials { + background: $gray-light; + + &:hover { + background: $gray-hover; + } + + h2 { + color: $gray-mid; + } + + svg { + color: $gray-mid; + } + } + } + + .StateMeta { + &.population { + h1, + h3 { + color: $gray; + } + } + + .meta-item { + &.population { + h1, + h3 { + color: $gray; + } + } + + &.confirmed { + background: $cherry-light; + + h3, + h5, + svg, + p { + color: $cherry-mid; + } + + h1 { + color: $cherry; + } + } + + &.active { + background: $blue-light; + + h3, + h5, + svg, + p { + color: $blue-mid; + } + + h1 { + color: $blue; + } + } + + &.recovery { + background: $green-light; + + h3, + h5, + svg, + p { + color: $green-mid; + } + + h1 { + color: $green; + } + } + + &.mortality { + background: $gray-light; + + h3, + h5, + svg, + p { + color: $gray-mid; + } + + h1 { + color: $gray; + } + } + + &.cpm { + background: $yellow-light; + + h3, + h5, + svg { + color: $orange-mid; + } + + h1 { + color: $orange; + } + } + + &.tpm { + background: $purple-light; + + h3, + h5, + svg, + p { + color: $purple-mid; + } + + h1 { + color: $purple; + } + } + + &.ptr { + background: $pink-light; + + h3, + h5, + svg, + p { + color: $pink-mid; + } + + h1 { + color: $pink; + } + } + + &.gr { + background: $brown-light; + + h3, + h5, + p, + svg { + color: $brown-mid; + } + + h1 { + color: $brown; + } + } + } + } + + .StateDropdown { + .state-name { + background: $brick-light; + } + + .dropdown { + background: $white; + + .item { + color: $red; + + &:hover { + background: $red-hover; + } + } + } + + .backdrop { + background: $red-light; + } + } + + .Essentials { + button { + background: $yellow-light; + color: $orange; + + &:hover { + background: $yellow-hover; + } + } + + .address { + color: $gray; + + svg { + stroke: $gray-mid; + } + } + + .essential-result { + background: $gray-light; + } + } + + .labels { + .label { + background: $gray-light !important; + color: $gray-mid !important; + + &.is-selected { + background: $yellow-hover !important; + color: $orange-mid !important; + + &:hover { + background: $yellow-hover !important; + color: $orange-mid !important; + } + } + + @media not all and (pointer: coarse) { + &:hover { + background: $yellow-light !important; + color: $orange-mid !important; + } + } + } + } + + .Banner { + background: $purple-light; + color: $purple; + } + + .Search { + label { + color: $gray; + } + + .line { + background: $gray-light; + } + + input { + background: var(--background-color); + border: 1px solid; + color: #fff; + } + + .search-placeholder { + color: $gray-mid; + } + + .search-button { + svg { + color: var(--primary-color); + } + } + + .close-button { + background: $gray-light !important; + + &:hover { + background: $gray-hover !important; + } + + svg { + stroke: $gray-mid; + } + + &.custom { + background: $pink-light !important; + + svg { + stroke: $pink !important; + } + } + } + + .feature { + background: $pink-light; + color: $pink; + } + + .expanded { + h4, + h3 { + color: $gray; + } + + h3 { + color: var(--primary-color); + } + } + + .results { + .pan-divider { + color: $gray; + } + + .result, + .essential-result { + border-bottom: 2px solid $gray-light; + color: $gray; + + &:hover { + background: $gray-light; + } + + .result-type { + background: $yellow-light; + color: $orange; + + &:hover { + background: $yellow-hover; + } + + svg { + stroke: $orange-mid; + } + } + + .result-zone { + &.is-red { + background: $cherry-light; + border: 2px solid $cherry-mid; + } + + &.is-orange { + background: $orange-light; + border: 2px solid $orange-mid; + } + + &.is-green { + background: $green-light; + border: 2px solid $green-mid; + } + } + } + + .essential-result { + .result-top { + .result-top-left { + .result-distance { + color: $green; + } + } + } + + .result-category { + background: $pink-light; + color: $pink; + + &:hover { + background: $pink-hover; + } + } + + .result-contact { + background: $gray-light; + color: $gray; + + &:hover { + background: $gray-hover; + } + + svg { + stroke: $gray-mid; + } + } + } + } + + .suggestions { + .suggestion { + color: $gray-mid; + } + } + } + + .header { + .actions { + &.timeline { + .highlight { + color: $brown !important; + } + } + + h5 { + color: $gray; + } + + svg { + color: $gray-mid; + + &:hover { + stroke: $gray; + } + } + + .timeline-icon { + svg { + fill: #a6abb0 !important; + + stroke: #a6abb0 !important; + + &:hover { + fill: $gray !important; + stroke: $gray !important; + } + } + } + + .bell-icon { + .indicator { + background: var(--primary-color); + } + } + } + } + + .Timeline { + .day { + h5 { + color: $gray-mid; + + &:hover { + color: $gray !important; + } + } + } + } + + .button { + background: $blue-light; + + color: $blue-mid; + + &.is-purple { + background: $purple-light; + color: $purple-mid; + + &:hover { + background: $purple-hover; + } + } + + &.is-green { + background: $green-light; + color: $green-mid; + + &:hover { + background: $green-hover; + } + } + + &:hover { + background: $blue-hover; + } + } + + .telegram { + background: $gray-light !important; + color: #08c !important; + + &:hover { + background: $gray-hover !important; + } + } + + .github { + color: #fff !important; + + &:hover { + svg { + path { + stroke: $gray !important; + } + } + } + } + + .excel { + background: #33a66730; + color: #33a667; + + &:hover { + background: #33a66750; + } + } + + .MapSwitcher { + .clickable { + &:hover { + &.is-confirmed { + background: $cherry-light; + } + + &.is-active { + background: $blue-light; + } + + &.is-recovered { + background: $green-light; + } + + &.is-deceased { + background: #6c757d30; + } + } + } + } + + .Level { + .is-confirmed { + h1, + h5 { + color: $cherry; + } + + h4 { + color: $cherry-mid; + } + } + + .is-active { + h1, + h5 { + color: $blue; + } + + h4 { + color: $blue-mid; + } + } + + .is-recovered { + h1, + h5 { + color: $green; + } + + h4 { + color: $green-mid; + } + } + + .is-deceased { + h1, + h5 { + color: $gray; + } + + h4 { + color: $gray-mid; + } + } + } + + abbr { + text-decoration: none; + + &.is-cherry { + color: $cherry; + } + + &.is-blue { + color: $blue; + } + + &.is-green { + color: $green; + } + + &.is-gray { + color: $gray; + } + } + + .fineprint { + .text { + color: #eee; + } + } + + .table { + .table-wrapper { + .row { + &:nth-child(odd) { + .cell { + background: var(--background-color); + } + } + + &.is-highlighted { + .cell { + background: $gray-opaque !important; + color: var(--background-color); + + .delta { + &.is-deceased { + color: #6c757d !important; + } + } + } + } + + &.heading { + .cell { + cursor: pointer; + user-select: none; + + &:hover { + background: $gray-opaque !important; + color: var(--background-color); + + .sort-icon { + svg { + fill: var(--background-color); + } + } + } + + .sort-icon { + svg { + fill: var(--primary-color); + } + } + } + } + + &.is-total { + position: sticky; + top: 0; + + .cell { + background: $gray-opaque !important; + color: var(--background-color); + } + } + + .cell { + color: $gray; + + &:first-child { + background: var(--background-color); + } + + svg { + color: $gray-mid; + } + + .sort-icon { + &.is-confirmed { + svg { + color: $cherry; + } + } + + &.is-active { + svg { + color: $blue; + } + } + + &.is-recovered { + svg { + color: $green; + } + } + + &.is-deceased { + svg { + color: $gray; + } + } + + &.is-tested { + svg { + color: $purple; + } + } + } + + &.statistic { + .is-confirmed { + color: $cherry; + } + + .is-recovered { + color: $green; + } + + .is-deceased { + color: $gray; + } + + .is-tested { + color: $purple; + } + } + + &:not(:last-child) { + margin-right: 0.25rem; + } + + &.heading { + background: $gray-light-opaque; + font-size: 13px; + font-weight: 900; + padding: 0.75rem 0.5rem; + + &:hover { + background: $gray-opaque !important; + color: var(--background-color); + } + } + + .state-name, + .district-name { + font-size: 14px; + font-weight: 600; + margin-right: 0.25rem; + width: 6rem; + word-wrap: break-word; + } + } + } + } + } + + table { + thead { + background: $gray-light; + color: $gray; + + th { + background: $gray-light-opaque; + + &:hover { + background: #ecedee; + } + } + } + + .heading-content { + abbr { + color: $gray; + + &.is-confirmed { + color: $cherry; + } + + &.is-active { + color: $blue; + } + + &.is-recovered { + color: $green; + } + + &.is-deaths { + color: $gray; + } + } + } + + tbody { + color: $gray; + + tr { + &:nth-child(odd) { + background: $gray-light; + } + + &.is-highlighted { + background: $gray-hover !important; + } + + &.is-odd { + background: $gray-light !important; + } + + &.is-total { + background: $gray-hover; + } + + &:hover { + background: $gray-hover !important; + + .dropdown { + background: $gray-hover; + } + } + } + + td { + .delta { + &.is-confirmed { + color: $cherry; + } + + &.is-active { + color: $blue; + } + + &.is-recovered { + color: $green; + } + + &.is-deaths { + color: $gray; + } + } + + &.is-Orange { + background: $yellow-light; + border-left: 5px solid $orange-mid; + color: $orange; + + svg { + color: $orange !important; + } + } + + &.is-Red { + background: $cherry-light; + border-left: 5px solid $cherry-mid; + color: $cherry; + + svg { + color: $cherry !important; + } + } + + &.is-Green { + background: $green-light; + border-left: 5px solid $green-mid; + color: $green; + + svg { + color: $green !important; + } + } + } + + .title-chevron { + .title-icon { + svg { + color: $gray-mid; + } + } + } + + .state-last-update { + color: $green !important; + + .disclaimer { + background: $gray-light; + + color: $gray; + } + + .state-page-link { + background: $yellow-light !important; + color: $orange; + + &:hover { + background: $yellow-hover !important; + } + } + } + + .district-heading { + background: $gray-light; + + &:hover { + background: $gray-light !important; + } + + td { + background: $gray-light; + color: $gray-dark; + } + } + } + + .affected-count { + color: $gray-mid; + } + + .unknown { + svg { + color: $gray-mid; + } + } + + .dropdown { + background: $gray-light; + + &:hover { + background: $gray-hover; + } + } + } + + .anchor { + svg { + color: $gray-mid; + + &:hover { + color: $gray; + } + } + + &.stickied { + svg { + color: $gray; + } + } + } + + .MapExplorer { + .header { + color: $gray; + } + + .svg-parent { + svg { + text { + fill: $gray; + } + } + } + + .last-update { + h6 { + color: $green-mid; + } + + h3 { + color: $green; + } + } + + .map-button { + background: $yellow-light; + + color: $orange; + + &:hover { + background: $yellow-hover; + } + + svg { + stroke: $orange-mid; + } + } + + .meta { + h2 { + &.confirmed { + color: $brick; + } + + &.active { + color: $blue; + } + + &.recovered { + color: $green; + } + + &.deceased { + color: $gray; + } + + &.tested { + color: $purple; + } + + &.Red { + color: #d73027; + } + + &.Orange { + color: #fee08b; + } + + &.Green { + color: #66bd63; + } + } + + h4 { + color: $gray-mid; + } + + .district { + &.confirmed { + color: $brick; + } + + &.active { + color: $blue; + } + + &.recovered { + color: $green; + } + + &.deceased { + color: $gray; + } + + &.tested { + color: $purple; + } + } + } + + .map-stats { + h3 { + color: $gray-mid; + } + + .stats { + &.confirmed { + background: $cherry-light; + + h5, + h6 { + color: $cherry-mid; + } + + h1 { + color: $cherry; + } + } + + &.recovered { + background: $green-light; + + h5, + h6 { + color: $green-mid; + } + + h1 { + color: $green; + } + } + + &.active { + background: $blue-light; + + h5, + h6 { + color: $blue-mid; + } + + h1 { + color: $blue; + } + } + + &.deceased { + background: $gray-light; + + h5, + h6 { + color: $gray-mid; + } + + h1 { + color: $gray; + } + } + + &.tested { + background: $purple-light; + + h5, + h6 { + color: $purple-mid; + } + + h1 { + color: $purple; + } + + svg { + stroke: $purple-mid; + + &:hover { + stroke: $purple; + } + } + } + + &.is-yellow { + background: $yellow; + + h5, + h6 { + color: $white; + } + + h1 { + color: $white; + } + } + } + } + + .disclaimer { + background: $gray-light; + + color: $gray-dark; + } + } + + .tabs { + .tab { + background: $gray-hover; + + color: $gray-mid; + + &:hover { + background: $gray-dark; + } + + &.focused { + background: $gray-opaque; + color: #000; + } + } + } + + .tabs-map { + .tab { + background: $gray-light; + + color: $gray-mid; + + &:hover { + background: $gray-hover; + } + + &.focused { + background: $gray-opaque; + color: #000; + } + + &.disabled { + background: $gray-opaque; + color: $gray-mid; + } + } + } + + .timeseries-header { + h1 { + color: $gray; + } + + .scale-modes { + color: $gray; + font-weight: 500; + + label { + color: $gray-mid; + } + + &:hover { + label { + &.main { + color: $gray; + } + } + } + } + } + + .disabled { + input { + &.switch { + background: $gray-dark !important; + border: $gray 2px solid !important; + } + + &::after { + background: $gray !important; + } + } + } + + input { + &.switch { + background-color: #fff; + border: 2px solid $gray-light; + + &::after { + background-color: var(--background-color); + } + + &:checked { + background-color: var(--primary-color); + + &::after { + background-color: $light; + } + } + } + } + + .trends-state-name { + select { + background-color: $gray-opaque; + + background-image: linear-gradient(45deg, transparent 50%, #808080 50%), + linear-gradient(135deg, #808080 50%, transparent 50%); + + border: 2px solid #e8e8e9; + + color: #000; + } + } + + .Timeseries, + .Minigraph { + .stats { + h2, + h5, + h6 { + color: $cherry-mid; + } + + h5 { + &.title { + color: $cherry; + } + } + + h2, + h6 { + color: $cherry; + } + + &.is-recovered { + h5 { + color: $green-mid; + + &.title { + color: $green; + } + } + + h2, + h6 { + color: $green; + } + } + + &.is-deceased { + h5 { + color: $gray-mid; + + &.title { + color: $gray; + } + } + + h2, + h6 { + color: $gray; + } + } + + &.is-active { + h5 { + color: $blue-mid; + + &.title { + color: $blue; + } + } + + h2, + h6 { + color: $blue; + } + } + + &.is-tested { + h5 { + color: $purple-mid; + + &.title { + color: $purple; + } + } + + h2, + h6 { + color: $purple; + } + } + } + } + + .svg-parent { + svg { + .domain, + .tick, + line { + stroke: $cherry; + } + + text { + color: $cherry-mid; + } + } + + &.is-recovered { + background: $green-light; + + svg { + .domain, + .tick, + line { + stroke: $green; + } + + text { + color: $green-mid; + } + } + } + + &.is-deceased { + background: $gray-light; + + svg { + .domain, + .tick, + line { + stroke: $gray; + } + + text { + color: $gray-mid; + } + } + } + + &.is-active { + background: $blue-light; + + svg { + .domain, + .tick, + line { + stroke: $blue; + } + + text { + color: $blue-mid; + } + } + } + + &.is-tested { + background: $purple-light; + + svg { + .domain, + .tick, + line { + stroke: $purple-mid !important; + } + + circle { + stroke: $purple !important; + } + + text { + color: $purple-mid; + } + } + } + } + + .floating-buttons { + button { + background: $yellow-mid; + color: $orange; + + &:hover { + background: #ffa500; + + svg { + stroke: #ffa500; + } + } + + svg { + stroke: $orange; + } + } + } + + .link { + a { + background: $blue-light; + color: $blue; + + &:hover { + background: $blue-hover; + } + } + + h3 { + color: $gray-dark; + } + } + + footer { + h5 { + color: $gray; + } + + .github { + color: #00000050; + + &:hover { + color: #000; + } + } + + .twitter { + color: $blue-mid; + + &:hover { + color: $blue; + } + } + + .api { + color: $yellow-mid; + + &:hover { + color: $yellow; + } + } + + .mail { + color: $brown-mid; + + &:hover { + color: $brown; + } + } + } + + .Summary { + h5 { + color: $gray; + } + + .summary-bottom { + & > * { + align-self: center; + } + } + } + + .faq { + .question { + color: #eee; + } + + .answer { + color: $blue; + } + + a { + background: $blue-light; + color: $blue; + } + } + + .Demographics { + .select { + .react-date-picker { + background-color: var(--background-color); + // border: 2px solid #e8e8e9 !important; + + color: #ababab; + } + + .react-calendar { + background: var(--background-color); + + button { + &:disabled { + background: var(--background-color); + color: $gray-mid; + } + } + } + + .react-date-picker__wrapper { + svg { + stroke: $gray-mid; + + &:hover { + stroke: $gray; + } + } + } + + .react-calendar__tile--active { + background: $pblue-light; + color: $pblue !important; + + &:hover { + background: $pblue-hover; + color: $pblue !important; + } + } + + .react-calendar__month-view__days__day--weekend, + .react-calendar__month-view__days__day { + color: $gray; + } + + .react-calendar__navigation__label { + color: $gray !important; + } + + .react-calendar__navigation__arrow { + color: $gray; + } + + .react-date-picker__inputGroup > * { + color: $gray !important; + } + + select { + background-color: var(--background-color); + + background-image: linear-gradient(45deg, transparent 50%, #808080 50%), + linear-gradient(135deg, #808080 50%, transparent 50%); + + border: 2px solid #e8e8e9; + + color: $gray; + } + } + + .reminder { + background: $pblue-light; + + color: var(--primary-color); + + svg { + stroke: $pblue-mid; + + &:hover { + stroke: var(--primary-color); + } + } + } + + .header { + h1 { + color: var(--primary-color); + } + + h3 { + color: $pblue-mid; + } + + h6 { + &.disclaimer { + color: $gray-mid; + } + } + + .deep-dive { + h5 { + color: $gray; + } + } + } + + .patientdb-wrapper { + .no-result { + h5 { + color: $gray; + + span { + color: $pblue !important; + } + } + } + } + } + + .Patients { + h5 { + &.daylabel { + color: var(--primary-color); + } + } + + .patient-card { + background: $gray-light; + + &:hover { + background: $gray-hover; + } + + h3 { + color: $gray-mid; + } + + &.is-small { + background: $gray-hover; + + &:hover { + background: $gray-mid; + } + + &.is-femme { + background: $pink; + } + + &.is-male { + background: var(--primary-color); + } + + &.is-local { + background: $cherry; + } + + &.is-imported { + background: $purple; + } + } + + &.is-femme { + background: $pink-mid; + + h3 { + color: $pink; + } + + &:hover { + background: $pink-hover; + } + } + + &.is-male { + background: $pblue-light; + + h3 { + color: var(--primary-color); + } + + &:hover { + background: $pblue-hover; + } + } + + &.is-local { + background: $cherry-light; + + h3 { + color: $cherry; + } + + &:hover { + background: $cherry-hover; + } + } + + &.is-imported { + background: $purple-light; + + h3 { + color: $purple; + } + + &:hover { + background: $purple-hover; + } + } + + &.is-in { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-uk { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-us { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-th { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-ph { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-it { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-ca { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-id { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.is-mm { + &:hover { + background: $gray-light; + + h3 { + color: $gray-mid; + } + } + } + + &.age1-9 { + background: #006400; + } + + &.age10-19 { + background: #00008b; + } + + &.age20-29 { + background: #b03060; + } + + &.age30-39 { + background: #ff4500; + } + + &.age40-49 { + background: #ff0; + } + + &.age50-59 { + background: #deb887; + } + + &.age60-69 { + background: #0f0; + } + + &.age70-79 { + background: #0ff; + } + + &.age80-89 { + background: #f0f; + } + + &.age90-99 { + background: #6495ed; + } + } + } + + .DownloadBlock { + code { + color: $orange-mid; + font-family: 'archia'; + } + + a { + color: $orange-mid; + } + + .button { + background: $orange-light; + + &:hover { + background: $orange-hover; + } + } + + svg { + stroke: $orange-mid; + } + } + + .modal { + background: $pblue-mid; + + .modal-content { + background: var(--background-color); + + svg { + stroke: $pblue-mid; + + &:hover { + stroke: var(--primary-color); + } + } + + h1 { + color: var(--primary-color); + } + + h3 { + color: var(--primary-color); + } + + h5 { + color: $pblue-mid; + } + + .meta { + h3 { + &:hover { + background: $pblue-light; + } + } + } + } + + .link { + a { + background: $pblue-light; + color: var(--primary-color); + + &:hover { + background: $pblue-hover; + } + } + } + } + + .patients-summary { + h1 { + color: $gray-dark; + } + + h6 { + color: $gray; + } + + .button { + background: $pblue-light; + color: var(--primary-color); + + &:hover { + background: $pblue-hover; + } + } + } + + .select { + display: flex; + flex-direction: column; + + label { + color: $gray-mid; + font-size: 0.75rem; + font-weight: 900; + margin-bottom: 0.25rem; + text-transform: uppercase; + } + } + + .filters { + background: var(--background-color) !important; + border-radius: 5px; + box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.12), inset 0 -1px 0 0 #1a1a1a; + } + + .pills { + > button { + background-color: $yellow-light; + border: 2px $yellow-light solid; + + color: $orange; + + &:hover { + background: $yellow-hover; + } + + &.selected { + background-color: $yellow-mid; + color: #000; + } + } + } + + .legend { + background: var(--background-color); + + h5 { + color: $gray; + + &.is-female { + color: $pink; + } + + &.is-male { + color: var(--primary-color); + } + + &.is-local { + color: $cherry; + } + + &.is-imported { + color: $purple; + } + } + + .circle { + background: $gray-mid; + + &.is-female { + background: $pink; + } + + &.is-male { + background: var(--primary-color); + } + + &.is-local { + background: $cherry; + } + + &.is-imported { + background: $purple; + } + } + } + + .updates-header { + color: $gray-dark; + + h2 { + color: var(--primary-color); + } + } + + .updates { + .update { + background: $gray-light; + + &:hover { + background: $gray-hover; + } + + h5 { + color: $gray-mid; + } + + h4 { + color: $gray; + } + } + + .button { + background: $pblue-light; + color: var(--primary-color); + + &:hover { + background: $pblue-hover; + } + } + } + + .district-bar { + h2 { + &.confirmed { + color: $red; + } + + &.active { + color: $blue; + } + + &.recovered { + color: $green; + } + + &.deceased { + color: $gray; + } + } + + .district-bar-left { + .button { + background: $gray-light; + color: $gray; + + &:hover { + background: $gray-hover; + } + } + } + + .districts { + .district { + h2, + h5 { + color: $gray; + } + + .delta { + h6 { + &.confirmed { + color: $red-mid; + } + + &.active { + color: $blue-mid; + } + + &.recovered { + color: $green-mid; + } + + &.deceased { + color: $gray-mid; + } + } + + svg { + &.confirmed { + color: $red-mid; + } + + &.active { + color: $blue-mid; + } + + &.recovered { + color: $green-mid; + } + + &.deceased { + color: $gray-mid; + } + } + } + } + } + } + + .LanguageSwitcher { + h3 { + color: var(--primary-color); + } + + .close-button { + background: $pblue-light; + + &:hover { + background: $pblue-hover; + } + + svg { + color: $pblue-mid; + + &:hover { + color: var(--primary-color); + } + } + } + + .languages { + .language { + color: $pblue-mid; + + &:hover { + color: var(--primary-color); + } + + &.is-highlighted { + background: $pblue-light; + color: var(--primary-color); + } + } + } + } + + .cards-container { + .cards { + .card { + .charts-header { + .chart-title { + color: #ababab; + } + + .chart-note { + color: $gray; + } + } + } + } + } + + .Tooltip { + .message { + background: #000; + + p { + color: $white !important; + } + } + } + + .table-top { + .option-toggle, + .info-toggle, + .million-toggle { + background: $gray-light; + color: $gray-mid; + + &.is-highlighted { + background: $green-light; + color: $green; + } + } + + .info-toggle { + &.is-highlighted { + background: $yellow-light; + color: $yellow; + } + } + + .million-toggle { + &.is-highlighted { + background: $pink-light; + color: $pink; + } + } + + .scroll-right-helper { + color: $gray-mid; + } + } + + @media (min-width: 769px) { + .Navbar { + background: $gray-light-opaque; + + .navbar-right { + background: $gray-light-opaque; + + &:hover { + background: $gray-light-opaque !important; + } + + & > span { + svg { + stroke: $gray; + } + } + } + + .expand { + background: $gray-light-opaque; + + & > * { + color: $gray; + } + } + } + } + + .theme-chooser-modal { + .color-chooser { + .colors { + background: #aeaeae10; + } + } + } +} + +.lights-out { + .Patients { + .patient-card { + background: $gray-hover; + + &:hover { + background: $gray-light !important; + } + + .is-small { + background: $gray-dark !important; + + &:hover { + background: $gray !important; + } + } + } + } +} diff --git a/src/tests/utils/index.js b/src/tests/utils/index.js index d80e1d9192..1668dbfa03 100644 --- a/src/tests/utils/index.js +++ b/src/tests/utils/index.js @@ -9,7 +9,7 @@ function removeUnknown(e) { } export async function getStatesAndDistrictsFromAPI() { - let url = 'https://api.covid19india.org/state_district_wise.json'; + const url = 'https://api.covid19india.org/state_district_wise.json'; const stateDistrictWiseResponse = await (await fetch(url)).json(); const states = Object.keys(stateDistrictWiseResponse).filter(removeUnknown); const result = {};