Skip to content

Commit be3ebff

Browse files
Fixed dark mode
1 parent 56933d1 commit be3ebff

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

src/components/CovidApp.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
import React, { Component } from "react";
2-
import { formatDistance } from "date-fns";
3-
import Overview from "./Overview";
4-
import { withStyles } from "@material-ui/styles";
5-
import colors from "../constants/colors";
6-
import Charts from "./Charts";
7-
import DisplayTable from "./DisplayTable";
8-
import styles from "../styles/CovidAppStyles";
9-
import axios from "axios";
10-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
111
import {
12-
faSyncAlt,
132
faBell,
143
faBellSlash,
4+
faSyncAlt,
155
} from "@fortawesome/free-solid-svg-icons";
16-
import "../styles/DarkModeButton.css";
17-
import MapSection from "./MapSection";
18-
import Barchart from "./Barchart";
19-
import stateCodes from "../constants/stateCodes";
6+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7+
import { withStyles } from "@material-ui/styles";
8+
import axios from "axios";
9+
import { formatDistance } from "date-fns";
10+
import React, { Component } from "react";
2011
import Lottie from "react-lottie";
2112
import * as animationData from "../assets/loading.json";
22-
// import FadeIn from "react-fade-in";
13+
import colors from "../constants/colors";
14+
import stateCodes from "../constants/stateCodes";
15+
import styles from "../styles/CovidAppStyles";
16+
import "../styles/DarkModeButton.css";
17+
import Barchart from "./Barchart";
18+
import Charts from "./Charts";
19+
import DisplayTable from "./DisplayTable";
2320
import Footer from "./Footer";
21+
import MapSection from "./MapSection";
22+
import Overview from "./Overview";
2423

2524
const defaultOptions = {
2625
loop: true,
@@ -86,11 +85,8 @@ class CovidApp extends Component {
8685
axios.spread((...responses) => {
8786
const countryData = responses[0].data;
8887
const districtLevel = responses[1].data;
89-
// const stateChanges = responses[2].data;
9088
const updates = responses[3].data;
9189

92-
// console.log(countryData.statewise[0].lastupdatedtime);
93-
9490
const [todayData] = countryData.statewise.slice(0, 1);
9591
const casesTimeline = countryData.cases_time_series;
9692

src/styles/CovidAppStyles.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ export default {
3737

3838
notification: {
3939
fontSize: "3rem",
40-
color: colors.darkPurple,
40+
color: ({ isDarkMode }) =>
41+
isDarkMode ? colors.lightPurple : colors.darkPurple,
4142
margin: "1rem",
4243
position: "relative",
4344
transition: "all .4s ease",
4445

4546
"&:hover": {
4647
transform: "scale(1.15)",
47-
color: "#000",
48+
color: ({ isDarkMode }) => (isDarkMode ? "rgba(255,255,255,.8)" : "#000"),
4849
},
4950
},
5051

@@ -77,7 +78,8 @@ export default {
7778
display: "block",
7879
position: "absolute",
7980
left: "-25rem",
80-
backgroundColor: "rgba(255,255,255,.95)",
81+
backgroundColor: ({ isDarkMode }) =>
82+
isDarkMode ? colors.darkPurple : "rgba(255,255,255,.95)",
8183
borderRadius: "2rem",
8284
boxShadow: "0 1rem 2rem rgba(0,0,0,.15)",
8385
padding: "3rem",

0 commit comments

Comments
 (0)