Skip to content

Commit f543f2f

Browse files
Minor change
1 parent 1268aa7 commit f543f2f

File tree

7 files changed

+72
-43
lines changed

7 files changed

+72
-43
lines changed

src/components/CovidApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class CovidApp extends Component {
207207
<h2 className={classes.tableHeading}>
208208
State/UT Wise Data (Sortable){" "}
209209
</h2>
210-
<DisplayTable tableData={tableData} />
210+
<DisplayTable tableData={tableData} isDarkMode={isDarkMode} />
211211
</div>
212212
</div>
213213
)}

src/components/DisplayTable.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ const useSortableData = (items, config = null) => {
3535
return { items: sortedItems, requestSort, sortConfig };
3636
};
3737

38-
const DisplayTable = (props) => {
39-
const { items, requestSort, sortConfig } = useSortableData(props.tableData);
38+
const DisplayTable = ({ tableData, isDarkMode }) => {
39+
const { items, requestSort, sortConfig } = useSortableData(tableData);
40+
const lightText = {
41+
color: isDarkMode && "rgba(255,255,255,.75)",
42+
};
4043
const getClassNamesFor = (name) => {
4144
if (!sortConfig) {
4245
return;
@@ -98,11 +101,11 @@ const DisplayTable = (props) => {
98101
<tbody>
99102
{items.map((item) => (
100103
<tr key={item.id}>
101-
<td>{item.name}</td>
102-
<td>{item.confirmed}</td>
103-
<td>{item.active}</td>
104-
<td>{item.discharged}</td>
105-
<td>{item.deaths}</td>
104+
<td style={lightText}>{item.name}</td>
105+
<td style={lightText}>{item.confirmed}</td>
106+
<td style={lightText}>{item.active}</td>
107+
<td style={lightText}>{item.discharged}</td>
108+
<td style={lightText}>{item.deaths}</td>
106109
</tr>
107110
))}
108111
</tbody>

src/components/MapSection.js

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,7 @@ import React, { Component } from "react";
22
import DisplayPanels from "./DisplayPanels";
33
import Map from "./Map/Map";
44
import { withStyles } from "@material-ui/styles";
5-
6-
const styles = {
7-
mainContainer: {
8-
backgroundColor: "rgba(129, 124, 155, 0.05)",
9-
padding: "7rem 3rem",
10-
textAlign: "center",
11-
},
12-
heading: {
13-
fontSize: "2.5rem",
14-
},
15-
para: {
16-
marginBottom: "3rem",
17-
color: "#bbb",
18-
},
19-
container: {
20-
display: "flex",
21-
justifyContent: "center",
22-
alignItems: "center",
23-
},
24-
mapContainer: {
25-
flex: "1",
26-
},
27-
panelsContainer: {
28-
display: "flex",
29-
flex: "0 0 30%",
30-
justifyContent: "center",
31-
flexWrap: "wrap",
32-
alignItems: "center",
33-
},
34-
singlePanel: {
35-
width: "50%",
36-
},
37-
};
5+
import styles from "../styles/MapSection";
386

397
class MapSection extends Component {
408
constructor(props) {

src/components/Paper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { withStyles } from "@material-ui/styles";
44
const styles = {
55
darkMode: {
66
backgroundColor: "#121212",
7-
color: "rgba(255,255,255,.87)",
7+
color: "rgba(255,255,255,.75)",
88
},
99
};
1010

src/constants/colors.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ export default {
66
darkPurple: "#1A1053",
77
lightPurple: "#817C9B",
88
};
9+
10+
// purple: rgb(98, 54, 255);
11+
// red: rgb(249, 52, 94);
12+
// green: rgb(28, 177, 66);
13+
// orange: rgb(250, 100, 0);
14+
// darkPurple: rgb(26, 16, 83);
15+
// lightPurple: rgb(129, 124, 155);

src/styles/DisplayPanelsStyles.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@ export default {
66
flexDirection: "column",
77
marginBottom: "3.5rem",
88
marginTop: "3.5rem",
9-
boxShadow: "0 1rem 2rem rgba(0, 0, 0, 0.05)",
9+
// boxShadow: "0 1rem 2rem rgba(0, 0, 0, 0.05)",
1010
backgroundColor: (props) => (props.isDarkMode ? colors.darkPurple : "#fff"),
1111
margin: (props) => (props.isMiniPanel ? "3rem 1rem" : "3.5rem 0"),
1212
padding: (props) => (props.isMiniPanel ? "1.5rem 1.5rem" : "1.5rem 3rem"),
1313
borderRadius: (props) => (props.isMiniPanel ? "2rem" : "2.5rem"),
14+
15+
boxShadow: (props) => {
16+
if (props.isMiniPanel) {
17+
return null;
18+
}
19+
let color;
20+
let title = props.title.toLowerCase();
21+
if (title === "recovered") {
22+
color = "rgb(28, 177, 66,.2)";
23+
} else if (title === "deceased") {
24+
color = "rgb(98, 54, 25,.2)";
25+
} else if (title === "active") {
26+
color = "rgb(250, 100, 0,.2)";
27+
} else if (title === "confirmed") {
28+
color = "rgb(249, 52, 94,.2)";
29+
}
30+
return `0 .5rem 3rem ${color}`;
31+
},
1432
},
1533

1634
heading: {
@@ -36,6 +54,7 @@ export default {
3654
paddingTop: ".5rem",
3755
paddingBottom: ".5rem",
3856
},
57+
3958
dataChange: {
4059
fontSize: (props) => (props.isMiniPanel ? "1.4rem" : "inherit"),
4160
color: (props) => {

src/styles/MapSection.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export default {
2+
mainContainer: {
3+
backgroundColor: "rgba(129, 124, 155, 0.05)",
4+
padding: "7rem 3rem",
5+
textAlign: "center",
6+
},
7+
heading: {
8+
fontSize: "2.5rem",
9+
},
10+
para: {
11+
marginBottom: "3rem",
12+
color: "#bbb",
13+
},
14+
container: {
15+
display: "flex",
16+
justifyContent: "center",
17+
alignItems: "center",
18+
},
19+
mapContainer: {
20+
flex: "1",
21+
},
22+
panelsContainer: {
23+
display: "flex",
24+
flex: "0 0 30%",
25+
justifyContent: "center",
26+
flexWrap: "wrap",
27+
alignItems: "center",
28+
},
29+
singlePanel: {
30+
width: "50%",
31+
},
32+
};

0 commit comments

Comments
 (0)