From 212dd73efd9e2bc743ce6fa6b089b38a826cbc93 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Tue, 30 Jun 2020 17:11:45 +0530
Subject: [PATCH 14/19] chore: Cleanup not required libs
---
package-lock.json | 22 ----------------------
package.json | 3 +--
2 files changed, 1 insertion(+), 24 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 67f6da559a..e1a6aefd4f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2154,11 +2154,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",
@@ -17096,23 +17091,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",
diff --git a/package.json b/package.json
index 0100292126..585d0cff1a 100644
--- a/package.json
+++ b/package.json
@@ -48,8 +48,7 @@
"react-use-gesture": "^7.0.15",
"source-map-explorer": "^2.4.2",
"swr": "^0.2.2",
- "topojson": "^3.0.2",
- "use-dark-mode": "^2.3.1"
+ "topojson": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
From 9d76a7285c7b9f62d7eefefc44440e1ceb1e4744 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Fri, 3 Jul 2020 18:50:51 +0530
Subject: [PATCH 15/19] style: Update classes after last merge into master
---
src/App.scss | 10 +-
src/components/Footer.js | 64 ++++
src/components/MapVisualizer.js | 543 ++++++++++++++++++++++++++++++++
src/components/Timeline.js | 2 +-
src/dark-theme.scss | 468 +++++++++++++++++++--------
5 files changed, 941 insertions(+), 146 deletions(-)
create mode 100644 src/components/Footer.js
create mode 100644 src/components/MapVisualizer.js
diff --git a/src/App.scss b/src/App.scss
index f624112039..1ffe2be6a0 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -3168,7 +3168,12 @@ footer {
color: $gray;
font-weight: 600;
margin: 0;
+ }
+
+ .moto {
+ border-color: var(--primary-color);
margin-bottom: 3.5rem;
+ width: 10%;
}
svg {
@@ -4165,8 +4170,3 @@ footer {
}
}
}
-
-.moto {
- border-color: var(--primary-color);
- width: 30%;
-}
diff --git a/src/components/Footer.js b/src/components/Footer.js
new file mode 100644
index 0000000000..c8a978b1e6
--- /dev/null
+++ b/src/components/Footer.js
@@ -0,0 +1,64 @@
+import React from 'react';
+import {Twitter, GitHub, Database, Mail} from 'react-feather';
+import {useTranslation} from 'react-i18next';
+
+function Footer(props) {
+ const {t} = useTranslation();
+
+ return (
+
+ );
+}
+
+export default React.memo(Footer);
diff --git a/src/components/MapVisualizer.js b/src/components/MapVisualizer.js
new file mode 100644
index 0000000000..072bc1ca60
--- /dev/null
+++ b/src/components/MapVisualizer.js
@@ -0,0 +1,543 @@
+import MapLegend from './MapLegend';
+
+import {
+ COLORS,
+ D3_TRANSITION_DURATION,
+ MAP_META,
+ MAP_TYPES,
+ MAP_VIEWS,
+ MAP_VIZS,
+ STATE_CODES,
+ STATE_NAMES,
+ UNKNOWN_DISTRICT_KEY,
+} from '../constants';
+import {
+ capitalizeAll,
+ formatNumber,
+ getStatistic,
+} from '../utils/commonFunctions';
+
+import classnames from 'classnames';
+import {max} from 'd3-array';
+import {json} from 'd3-fetch';
+import {geoIdentity, geoPath} from 'd3-geo';
+import {scaleSqrt, scaleSequential} from 'd3-scale';
+// eslint-disable-next-line
+// import worker from 'workerize-loader!../workers/mapVisualizer';
+import {
+ interpolateReds,
+ interpolateBlues,
+ interpolateGreens,
+ interpolateGreys,
+ interpolatePurples,
+} from 'd3-scale-chromatic';
+import {select, event} from 'd3-selection';
+import {transition} from 'd3-transition';
+import React, {useCallback, useEffect, useMemo, useRef} from 'react';
+import * as Icon from 'react-feather';
+import {useTranslation} from 'react-i18next';
+import {useHistory} from 'react-router-dom';
+import useSWR from 'swr';
+import * as topojson from 'topojson';
+
+const [width, height] = [432, 488];
+
+const colorInterpolator = {
+ confirmed: (t) => interpolateReds(t * 0.85),
+ active: (t) => interpolateBlues(t * 0.85),
+ recovered: (t) => interpolateGreens(t * 0.85),
+ deceased: (t) => interpolateGreys(t * 0.85),
+ tested: (t) => interpolatePurples(t * 0.85),
+};
+
+const getTotalStatistic = (data, statistic) => {
+ return getStatistic(data, 'total', statistic);
+};
+
+function MapVisualizer({
+ mapCode,
+ mapView,
+ mapViz,
+ data,
+ changeMap,
+ regionHighlighted,
+ setRegionHighlighted,
+ statistic,
+ isCountryLoaded,
+}) {
+ const {t} = useTranslation();
+ const svgRef = useRef(null);
+
+ const mapMeta = MAP_META[mapCode];
+ const history = useHistory();
+
+ const {data: geoData} = useSWR(
+ mapMeta.geoDataFile,
+ async (file) => {
+ return await json(file);
+ },
+ {suspense: false, revalidateOnFocus: false}
+ );
+
+ const statisticMax = useMemo(() => {
+ const stateCodes = Object.keys(data).filter(
+ (stateCode) =>
+ stateCode !== 'TT' && Object.keys(MAP_META).includes(stateCode)
+ );
+
+ return mapView === MAP_VIEWS.STATES
+ ? max(stateCodes, (stateCode) =>
+ getTotalStatistic(data[stateCode], statistic)
+ )
+ : max(stateCodes, (stateCode) =>
+ data[stateCode]?.districts
+ ? max(Object.values(data[stateCode].districts), (districtData) =>
+ getTotalStatistic(districtData, statistic)
+ )
+ : 0
+ );
+ }, [data, mapView, statistic]);
+
+ const statisticTotal = useMemo(() => {
+ return getTotalStatistic(data[mapCode], statistic);
+ }, [data, mapCode, statistic]);
+
+ const mapScale = useMemo(() => {
+ if (mapViz === MAP_VIZS.BUBBLES) {
+ return scaleSqrt([0, Math.max(statisticMax, 1)], [0, 40])
+ .clamp(true)
+ .nice(3);
+ } else {
+ return scaleSequential(
+ [0, Math.max(1, statisticMax)],
+ colorInterpolator[statistic]
+ ).clamp(true);
+ }
+ }, [mapViz, statistic, statisticMax]);
+
+ const path = useMemo(() => {
+ if (!geoData) return null;
+ return geoPath(geoIdentity());
+ }, [geoData]);
+
+ const fillColor = useCallback(
+ (d) => {
+ const stateCode = STATE_CODES[d.properties.st_nm];
+ const district = d.properties.district;
+ const stateData = data[stateCode];
+ const districtData = stateData?.districts?.[district];
+ let n;
+ if (district) n = getTotalStatistic(districtData, statistic);
+ else n = getTotalStatistic(stateData, statistic);
+ const color = n === 0 ? '#ffffff00' : mapScale(n);
+ return color;
+ },
+ [data, mapScale, statistic]
+ );
+
+ const strokeColor = useCallback(() => {
+ return COLORS[statistic];
+ }, [statistic]);
+
+ const features = useMemo(() => {
+ if (!geoData) return null;
+ const featuresWrap =
+ mapView === MAP_VIEWS.STATES
+ ? topojson.feature(geoData, geoData.objects.states).features
+ : mapMeta.mapType === MAP_TYPES.COUNTRY && mapViz === MAP_VIZS.BUBBLES
+ ? [
+ ...topojson.feature(geoData, geoData.objects.states).features,
+ ...topojson.feature(geoData, geoData.objects.districts).features,
+ ]
+ : topojson.feature(geoData, geoData.objects.districts).features;
+
+ // Add id to each feature
+ return featuresWrap.map((feature) => {
+ const district = feature.properties.district;
+ const state = feature.properties.st_nm;
+ const obj = Object.assign({}, feature);
+ obj.id = `${mapCode}-${state}${district ? '-' + district : ''}`;
+ return obj;
+ });
+ }, [geoData, mapCode, mapView, mapViz, mapMeta]);
+
+ const populateTexts = useCallback(
+ (regionSelection) => {
+ regionSelection.select('title').text((d) => {
+ if (mapViz === MAP_VIZS.CHOROPLETH) {
+ const state = d.properties.st_nm;
+ const stateCode = STATE_CODES[state];
+ const district = d.properties.district;
+
+ const stateData = data[stateCode];
+ const districtData = stateData?.districts?.[district];
+ let n;
+ if (district) n = getTotalStatistic(districtData, statistic);
+ else n = getTotalStatistic(stateData, statistic);
+ return (
+ formatNumber(100 * (n / (statisticTotal || 0.001))) +
+ '% from ' +
+ capitalizeAll(district ? district : state)
+ );
+ }
+ });
+ },
+ [mapViz, data, statistic, statisticTotal]
+ );
+
+ // Reset on tapping outside map
+ useEffect(() => {
+ const svg = select(svgRef.current);
+
+ svg.attr('pointer-events', 'auto').on(
+ 'click',
+ setRegionHighlighted.bind(this, {
+ stateCode: mapCode,
+ districtName: null,
+ })
+ );
+ }, [mapCode, setRegionHighlighted]);
+
+ // Choropleth
+ useEffect(() => {
+ if (!geoData) return;
+ const svg = select(svgRef.current);
+ const T = transition().duration(D3_TRANSITION_DURATION);
+
+ let onceTouchedRegion = null;
+
+ const regionSelection = svg
+ .select('.regions')
+ .selectAll('path')
+ .data(mapViz !== MAP_VIZS.BUBBLES ? features : [], (d) => d.id)
+ .join(
+ (enter) =>
+ enter
+ .append('path')
+ .attr('d', path)
+ .attr('stroke-width', 1.8)
+ .attr('stroke-opacity', 0)
+ .style('cursor', 'pointer')
+ .on('mouseenter', (d) => {
+ setRegionHighlighted({
+ stateCode: STATE_CODES[d.properties.st_nm],
+ districtName: d.properties.district,
+ });
+ })
+ .attr('fill', '#fff0')
+ .attr('stroke', '#fff0')
+ .call((enter) => {
+ enter.append('title');
+ }),
+ (update) => update,
+ (exit) =>
+ exit
+ .transition(T)
+ .attr('stroke', '#fff0')
+ .attr('fill', '#fff0')
+ .remove()
+ )
+ .attr('pointer-events', 'all')
+ .on('touchstart', (d) => {
+ if (onceTouchedRegion === d) onceTouchedRegion = null;
+ else onceTouchedRegion = d;
+ })
+ .on('click', (d) => {
+ event.stopPropagation();
+ const stateCode = STATE_CODES[d.properties.st_nm];
+ if (
+ onceTouchedRegion ||
+ mapMeta.mapType === MAP_TYPES.STATE ||
+ !data[stateCode]?.districts
+ )
+ return;
+ // Disable pointer events till the new map is rendered
+ svg.attr('pointer-events', 'none');
+ svg.select('.regions').selectAll('path').attr('pointer-events', 'none');
+ // Switch map
+ history.push(
+ `/state/${stateCode}${window.innerWidth < 769 ? '#MapExplorer' : ''}`
+ );
+ })
+ .call((sel) => {
+ sel.transition(T).attr('fill', fillColor).attr('stroke', strokeColor);
+ });
+
+ window.requestIdleCallback(() => {
+ populateTexts(regionSelection);
+ });
+ }, [
+ mapViz,
+ data,
+ features,
+ fillColor,
+ geoData,
+ history,
+ mapMeta.mapType,
+ path,
+ populateTexts,
+ setRegionHighlighted,
+ strokeColor,
+ ]);
+
+ // Bubble
+ useEffect(() => {
+ if (!features) return;
+
+ const svg = select(svgRef.current);
+ const T = transition().duration(D3_TRANSITION_DURATION);
+
+ let circlesData = [];
+
+ if (mapViz === MAP_VIZS.BUBBLES) {
+ circlesData = features
+ .map((feature) => {
+ const stateCode = STATE_CODES[feature.properties.st_nm];
+ const districtName = feature.properties.district;
+ const stateData = data[stateCode];
+
+ if (mapView === MAP_VIEWS.STATES) {
+ feature.value = getTotalStatistic(stateData, statistic);
+ } else if (mapView === MAP_VIEWS.DISTRICTS) {
+ const districtData = stateData?.districts?.[districtName];
+
+ if (districtName)
+ feature.value = getTotalStatistic(districtData, statistic);
+ else
+ feature.value = getTotalStatistic(
+ stateData?.districts?.[UNKNOWN_DISTRICT_KEY],
+ statistic
+ );
+ }
+
+ return feature;
+ })
+ .sort((featureA, featureB) => featureB.value - featureB.value);
+ }
+
+ let onceTouchedRegion = null;
+ svg
+ .select('.circles')
+ .selectAll('circle')
+ .data(circlesData, (feature) => feature.id)
+ .join(
+ (enter) =>
+ enter
+ .append('circle')
+ .attr(
+ 'transform',
+ (feature) => `translate(${path.centroid(feature)})`
+ )
+ .attr('fill-opacity', 0.25)
+ .style('cursor', 'pointer')
+ .attr('pointer-events', 'all'),
+ (update) => update,
+ (exit) => exit.call((exit) => exit.transition(T).attr('r', 0).remove())
+ )
+ .on('mouseenter', (feature) => {
+ setRegionHighlighted({
+ stateCode: STATE_CODES[feature.properties.st_nm],
+ districtName:
+ mapView === MAP_VIEWS.STATES
+ ? null
+ : feature.properties.district || UNKNOWN_DISTRICT_KEY,
+ });
+ })
+ .on('touchstart', (feature) => {
+ if (onceTouchedRegion === feature) onceTouchedRegion = null;
+ else onceTouchedRegion = feature;
+ })
+ .on('click', (feature) => {
+ event.stopPropagation();
+ if (onceTouchedRegion || mapMeta.mapType === MAP_TYPES.STATE) return;
+ history.push(
+ `/state/${STATE_CODES[feature.properties.st_nm]}${
+ window.innerWidth < 769 ? '#MapExplorer' : ''
+ }`
+ );
+ })
+ .transition(T)
+ .attr('fill', COLORS[statistic] + '70')
+ .attr('stroke', COLORS[statistic] + '70')
+ .attr('r', (feature) => mapScale(feature.value));
+ }, [
+ mapMeta.mapType,
+ mapViz,
+ mapView,
+ data,
+ features,
+ history,
+ mapScale,
+ path,
+ setRegionHighlighted,
+ statistic,
+ ]);
+
+ const getBoundaryColor = useCallback(
+ (statistic) => {
+ return COLORS[statistic] + '40';
+
+ // eslint-disable-next-line
+ const faux = mapCode;
+ },
+ [mapCode]
+ );
+
+ // Boundaries
+ useEffect(() => {
+ if (!geoData) return;
+ const svg = select(svgRef.current);
+ const T = transition().duration(D3_TRANSITION_DURATION);
+
+ let meshStates = [];
+ let meshDistricts = [];
+
+ if (mapMeta.mapType === MAP_TYPES.COUNTRY) {
+ meshStates = [topojson.mesh(geoData, geoData.objects.states)];
+ meshStates[0].id = `${mapCode}-states`;
+ }
+
+ if (
+ mapMeta.mapType === MAP_TYPES.STATE ||
+ (mapView === MAP_VIEWS.DISTRICTS && mapViz === MAP_VIZS.CHOROPLETH)
+ ) {
+ // Add id to mesh
+ meshDistricts = [topojson.mesh(geoData, geoData.objects.districts)];
+ meshDistricts[0].id = `${mapCode}-districts`;
+ }
+
+ svg
+ .select('.state-borders')
+ .attr('fill', 'none')
+ .attr('stroke-width', 1.5)
+ .selectAll('path')
+ .data(meshStates, (d) => d.id)
+ .join(
+ (enter) => enter.append('path').attr('d', path).attr('stroke', '#fff0'),
+ (update) => update,
+ (exit) => exit.transition(T).attr('stroke', '#fff0').remove()
+ )
+ .transition(T)
+ .attr('stroke', getBoundaryColor.bind(this, statistic));
+
+ svg
+ .select('.district-borders')
+ .attr('fill', 'none')
+ .attr('stroke-width', 1.5)
+ .selectAll('path')
+ .data(meshDistricts, (d) => d.id)
+ .join(
+ (enter) =>
+ enter
+ .append('path')
+ .attr('d', path)
+ .attr('d', path)
+ .attr('stroke', '#fff0'),
+ (update) => update,
+ (exit) => exit.transition(T).attr('stroke', '#fff0').remove()
+ )
+ .transition(T)
+ .attr('stroke', getBoundaryColor.bind(this, statistic));
+ }, [
+ geoData,
+ mapMeta,
+ mapCode,
+ mapViz,
+ mapView,
+ statistic,
+ path,
+ getBoundaryColor,
+ ]);
+
+ // Highlight
+ useEffect(() => {
+ const stateName = STATE_NAMES[regionHighlighted.stateCode];
+ const district = regionHighlighted.districtName;
+
+ const svg = select(svgRef.current);
+
+ if (mapViz === MAP_VIZS.BUBBLES) {
+ svg
+ .select('.circles')
+ .selectAll('circle')
+ .attr('fill-opacity', (d) => {
+ const highlighted =
+ stateName === d.properties.st_nm &&
+ (!district ||
+ district === d.properties?.district ||
+ (district === UNKNOWN_DISTRICT_KEY && !d.properties.district));
+ return highlighted ? 1 : 0.25;
+ });
+ } else {
+ svg
+ .select('.regions')
+ .selectAll('path')
+ .each(function (d) {
+ const highlighted =
+ stateName === d.properties.st_nm &&
+ (mapView === MAP_VIEWS.STATES ||
+ district === d.properties?.district);
+ if (highlighted) this.parentNode.appendChild(this);
+ select(this).attr('stroke-opacity', highlighted ? 1 : 0);
+ });
+ }
+ }, [
+ geoData,
+ data,
+ mapView,
+ mapViz,
+ regionHighlighted.stateCode,
+ regionHighlighted.districtName,
+ statistic,
+ ]);
+
+ return (
+
+
+
+ {mapMeta.mapType === MAP_TYPES.STATE &&
+ !!getTotalStatistic(
+ data[mapCode]?.districts?.[UNKNOWN_DISTRICT_KEY],
+ statistic
+ ) && (
+
+
+
+ {t('District-wise {{statistic}} numbers need reconciliation', {
+ statistic: t(statistic),
+ })}
+
+
+ )}
+
+
+ {mapScale && }
+
+
+
+ );
+}
+
+export default MapVisualizer;
diff --git a/src/components/Timeline.js b/src/components/Timeline.js
index b001c209d1..98937cf613 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/dark-theme.scss b/src/dark-theme.scss
index 714520959d..bc06e7565a 100644
--- a/src/dark-theme.scss
+++ b/src/dark-theme.scss
@@ -2,7 +2,7 @@ $blue: #007bff;
$blue-light: #007bff10;
$blue-hover: #007bff30;
$blue-light-opaque: #eff7ff;
-$blue-mid: #007bff99;
+$blue-mid: #007bffdd;
$pblue: #4c75f2;
$pblue-light: #4c75f230;
$pblue-hover: #4c75f250;
@@ -25,7 +25,7 @@ $orange-light-opaque: #ffefe2;
$yellow: #ffc107;
$yellow-light: #ffc10720;
$yellow-hover: #ffc10730;
-$yellow-mid: #ffc10799;
+$yellow-mid: #ffc107dd;
$yellow-light-opaque: #fff7e0;
$green: #28a745;
$green-light: #28a74520;
@@ -55,9 +55,11 @@ $pink-mid: #fb558199;
$brown: #b6854d;
$brown-light: #b6854d10;
$brown-hover: #b6854d30;
-$brown-mid: #b6854d99;
+$brown-mid: #b6854ddd;
$brick: #e23028;
$brick-light: #e2302810;
+$gray-hover-darker-opaque: #1a1a1a20;
+$gray-hover-opaque: #edeeef20;
$default-primary: var(--primary-color);
@@ -160,31 +162,31 @@ $default-primary: var(--primary-color);
}
}
- .State {
- .header {
- .header-left {
- h1 {
- color: $brick;
- }
+ .StateHeader {
+ .header-left {
+ h1 {
+ color: $brick;
+ max-width: 20rem;
+ }
- h5 {
- color: $gray;
- }
+ h5 {
+ color: $gray;
}
+ }
- .header-right {
- color: $purple-mid;
+ .header-right {
+ color: $purple-mid;
- h2 {
- color: $purple;
- }
+ h2 {
+ color: $purple;
+ font-weight: 900;
+ }
- a {
- background: $purple-light;
+ a {
+ background: $purple-light;
- &:hover {
- background: $purple-hover;
- }
+ &:hover {
+ background: $purple-hover;
}
}
}
@@ -214,122 +216,131 @@ $default-primary: var(--primary-color);
}
}
- &.confirmed {
- background: $cherry-light;
-
- h3,
- h5,
- svg,
- p {
- color: $cherry-mid;
+ .meta-item {
+ &.population {
+ h1,
+ h3 {
+ color: $gray;
+ }
}
- h1 {
- color: $cherry;
- }
- }
+ &.confirmed {
+ background: $cherry-light;
- &.active {
- background: $blue-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $cherry-mid;
+ }
- h3,
- h5,
- svg,
- p {
- color: $blue-mid;
+ h1 {
+ color: $cherry;
+ }
}
- h1 {
- color: $blue;
- }
- }
+ &.active {
+ background: $blue-light;
- &.recovery {
- background: $green-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $blue-mid;
+ }
- h3,
- h5,
- svg,
- p {
- color: $green-mid;
+ h1 {
+ color: $blue;
+ }
}
- h1 {
- color: $green;
- }
- }
+ &.recovery {
+ background: $green-light;
- &.mortality {
- background: $gray-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $green-mid;
+ }
- h3,
- h5,
- svg,
- p {
- color: $gray-mid;
+ h1 {
+ color: $green;
+ }
}
- h1 {
- color: $gray;
- }
- }
+ &.mortality {
+ background: $gray-light;
- &.cpm {
- background: $yellow-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $gray-mid;
+ }
- h3,
- h5,
- svg {
- color: $orange-mid;
+ h1 {
+ color: $gray;
+ }
}
- h1 {
- color: $orange;
- }
- }
+ &.cpm {
+ background: $yellow-light;
- &.tpm {
- background: $purple-light;
+ h3,
+ h5,
+ svg {
+ color: $orange-mid;
+ }
- h3,
- h5,
- svg,
- p {
- color: $purple-mid;
+ h1 {
+ color: $orange;
+ }
}
- h1 {
- color: $purple;
- }
- }
+ &.tpm {
+ background: $purple-light;
- &.ptr {
- background: $pink-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $purple-mid;
+ }
- h3,
- h5,
- svg,
- p {
- color: $pink-mid;
+ h1 {
+ color: $purple;
+ }
}
- h1 {
- color: $pink;
- }
- }
+ &.ptr {
+ background: $pink-light;
- &.gr {
- background: $brown-light;
+ h3,
+ h5,
+ svg,
+ p {
+ color: $pink-mid;
+ }
- h3,
- h5,
- p,
- svg {
- color: $brown-mid;
+ h1 {
+ color: $pink;
+ }
}
- h1 {
- color: $brown;
+ &.gr {
+ background: $brown-light;
+
+ h3,
+ h5,
+ p,
+ svg {
+ color: $brown-mid;
+ }
+
+ h1 {
+ color: $brown;
+ }
}
}
}
@@ -662,20 +673,24 @@ $default-primary: var(--primary-color);
}
}
- .map-switcher {
- .highlight {
- background: $cherry-light;
+ .MapSwitcher {
+ .clickable {
+ &:hover {
+ &.is-confirmed {
+ background: $cherry-light;
+ }
- &.active {
- background: $blue-light;
- }
+ &.is-active {
+ background: $blue-light;
+ }
- &.recovered {
- background: $green-light;
- }
+ &.is-recovered {
+ background: $green-light;
+ }
- &.deceased {
- background: $gray-light;
+ &.is-deceased {
+ background: #6c757d30;
+ }
}
}
}
@@ -753,20 +768,125 @@ $default-primary: var(--primary-color);
}
.table {
- .cell {
- &:first-child {
- background: var(--background-color) !important;
- }
+ .table-wrapper {
+ .row {
+ &:nth-child(odd) {
+ .cell {
+ background: $gray-light;
+ }
+ }
- &.heading {
- background: var(--background-color) !important;
- }
- }
+ &.is-highlighted {
+ .cell {
+ background: $gray-hover-opaque !important;
+ }
+ }
- .is-highlighted,
- .is-total {
- .cell {
- background: var(--background-color) !important;
+ &.heading {
+ .cell {
+ cursor: pointer;
+ user-select: none;
+
+ &:hover {
+ background: $gray-hover-opaque !important;
+ }
+ }
+ }
+
+ &.is-total {
+ position: sticky;
+ top: 0;
+
+ .cell {
+ background: $gray-hover-opaque !important;
+ }
+ }
+
+ .cell {
+ color: $gray;
+
+ &:first-child {
+ background: $gray-hover-darker-opaque;
+ }
+
+ 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-hover-opaque !important;
+ }
+ }
+
+ .state-name,
+ .district-name {
+ font-size: 14px;
+ font-weight: 600;
+ margin-right: 0.25rem;
+ width: 6rem;
+ word-wrap: break-word;
+ }
+ }
}
}
}
@@ -1164,12 +1284,12 @@ $default-primary: var(--primary-color);
.tabs {
.tab {
- background: $gray-light;
+ background: $gray-hover;
color: $gray-mid;
&:hover {
- background: $gray-hover;
+ background: $gray-dark;
}
&.focused {
@@ -1227,8 +1347,12 @@ $default-primary: var(--primary-color);
.disabled {
input {
&.switch {
- background: $gray-light !important;
- border: $gray-light 2px solid !important;
+ background: $gray-dark !important;
+ border: $gray 2px solid !important;
+ }
+
+ &::after {
+ background: $gray !important;
}
}
}
@@ -1236,14 +1360,14 @@ $default-primary: var(--primary-color);
input {
&.switch {
background-color: #fff;
- border: 2px solid #d9dadc;
+ border: 2px solid $gray-light;
&::after {
- background-color: $gray-mid;
+ background-color: var(--background-color);
}
&:checked {
- background-color: $gray-light;
+ background-color: var(--primary-color);
&::after {
background-color: $light;
@@ -1265,7 +1389,7 @@ $default-primary: var(--primary-color);
}
}
- .TimeSeries,
+ .Timeseries,
.Minigraph {
.stats {
h2,
@@ -1467,6 +1591,38 @@ $default-primary: var(--primary-color);
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 {
@@ -1481,7 +1637,7 @@ $default-primary: var(--primary-color);
}
}
- .FAQ {
+ .faq {
.question {
color: #eee;
}
@@ -2182,6 +2338,38 @@ $default-primary: var(--primary-color);
}
}
+ .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;
From d5bfc6d16cd8cd4b1cc29a39fdfc0d04c03f2834 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Fri, 3 Jul 2020 18:53:08 +0530
Subject: [PATCH 16/19] chore: Remove commented out styles
---
src/dark-theme.scss | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/dark-theme.scss b/src/dark-theme.scss
index bc06e7565a..84fa5e1800 100644
--- a/src/dark-theme.scss
+++ b/src/dark-theme.scss
@@ -109,8 +109,6 @@ $default-primary: var(--primary-color);
color: $gray;
& > * {
- // border-bottom: 1px solid $gray-light;
- // border-top: 1px solid $gray-light;
border: 0;
&:hover {
From 2a42f3b9ac07efd8918fe51a36240b86e3d7e208 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Mon, 6 Jul 2020 18:00:15 +0530
Subject: [PATCH 17/19] Fix: colors in table on:hover
---
src/dark-theme.scss | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/dark-theme.scss b/src/dark-theme.scss
index ece197d70e..f7989185a9 100644
--- a/src/dark-theme.scss
+++ b/src/dark-theme.scss
@@ -800,13 +800,20 @@ $default-primary: var(--primary-color);
.row {
&:nth-child(odd) {
.cell {
- background: $gray-light;
+ background: var(--background-color);
}
}
&.is-highlighted {
.cell {
- background: $gray-hover-opaque !important;
+ background: $gray-opaque !important;
+ color: var(--background-color);
+
+ .delta {
+ &.is-deceased {
+ color: #6c757d !important;
+ }
+ }
}
}
@@ -816,7 +823,20 @@ $default-primary: var(--primary-color);
user-select: none;
&:hover {
- background: $gray-hover-opaque !important;
+ background: $gray-opaque !important;
+ color: var(--background-color);
+
+ .sort-icon {
+ svg {
+ fill: var(--background-color);
+ }
+ }
+ }
+
+ .sort-icon {
+ svg {
+ fill: var(--primary-color);
+ }
}
}
}
@@ -826,7 +846,8 @@ $default-primary: var(--primary-color);
top: 0;
.cell {
- background: $gray-hover-opaque !important;
+ background: $gray-opaque !important;
+ color: var(--background-color);
}
}
@@ -834,7 +855,7 @@ $default-primary: var(--primary-color);
color: $gray;
&:first-child {
- background: $gray-hover-darker-opaque;
+ background: var(--background-color);
}
svg {
@@ -902,7 +923,8 @@ $default-primary: var(--primary-color);
padding: 0.75rem 0.5rem;
&:hover {
- background: $gray-hover-opaque !important;
+ background: $gray-opaque !important;
+ color: var(--background-color);
}
}
From 98351c2b154d0cdbd0538bdf55ba94b55844bad4 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Wed, 15 Jul 2020 17:13:04 +0530
Subject: [PATCH 18/19] Fix: Github icon hover color
---
src/dark-theme.scss | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/dark-theme.scss b/src/dark-theme.scss
index f7989185a9..fbe51bfaa3 100644
--- a/src/dark-theme.scss
+++ b/src/dark-theme.scss
@@ -684,11 +684,14 @@ $default-primary: var(--primary-color);
}
.github {
- background: #000 !important;
color: #fff !important;
&:hover {
- background: $gray-dark !important;
+ svg {
+ path {
+ stroke: $gray !important;
+ }
+ }
}
}
From 62526c3d979c825d292e1bf59b84c577d4f92840 Mon Sep 17 00:00:00 2001
From: Balraj Singh <37571874+balrajsingh9@users.noreply.github.com>
Date: Wed, 15 Jul 2020 17:15:58 +0530
Subject: [PATCH 19/19] fix: Fix accessibility issue and remove debug statement
---
src/App.js | 2 +-
src/components/themechooser.js | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index ffda12c58b..6efb26cc58 100644
--- a/src/App.js
+++ b/src/App.js
@@ -117,7 +117,7 @@ const App = () => {
{...{pColor, bgColor}}
/>
)}
-