Skip to content

Commit 56933d1

Browse files
Fix Dark Mode Bug
1 parent 2ea211e commit 56933d1

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

src/App.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,21 @@ class App extends Component {
4141
/>
4242
)}
4343
/>
44-
<Route exact path="/symptoms" render={() => <Symptoms />} />
45-
<Route exact path="/stay-safe" render={() => <StaySafe />} />
46-
<Route exact path="/essentials" render={() => <Help />} />
44+
<Route
45+
exact
46+
path="/symptoms"
47+
render={() => <Symptoms isDarkMode={isDarkMode} />}
48+
/>
49+
<Route
50+
exact
51+
path="/stay-safe"
52+
render={() => <StaySafe isDarkMode={isDarkMode} />}
53+
/>
54+
<Route
55+
exact
56+
path="/essentials"
57+
render={() => <Help isDarkMode={isDarkMode} />}
58+
/>
4759
<Route
4860
path="/"
4961
render={() => (

src/components/StaySafe.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ class StaySafe extends Component {
1919
{ src: Fifth, title: "Keep Distance" },
2020
{ src: Sixth, title: "Stay Home Stay Safe" },
2121
];
22-
const { classes } = this.props;
22+
const { classes, isDarkMode } = this.props;
2323
return (
2424
<div className={classes.staySafe}>
2525
<h1>Stay Safe</h1>
2626
<div className={classes.cardsBox}>
2727
{svgIcons.map((s, i) => (
28-
<Cards key={i} src={s.src} title={s.title} />
28+
<Cards
29+
key={i}
30+
src={s.src}
31+
title={s.title}
32+
isDarkMode={isDarkMode}
33+
/>
2934
))}
3035
</div>
3136
</div>

src/styles/CardsStyles.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sizes from "./sizes";
2+
import colors from "../constants/colors";
23

34
export default {
45
card: {
@@ -9,7 +10,8 @@ export default {
910
alignItems: "center",
1011
flex: "0 0 20%",
1112
padding: "3rem 4rem",
12-
backgroundColor: "#fff",
13+
backgroundColor: ({ isDarkMode }) =>
14+
isDarkMode ? colors.darkPurple : "#fff",
1315
marginBottom: "7rem",
1416
transition: "all .5s",
1517
boxShadow: `0 1px 2.3px -50px rgba(0, 0, 0, 0.014),

src/styles/HelpStyles.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sizes from "./sizes";
2+
import colors from "../constants/colors";
23

34
export default {
45
help: {
@@ -26,7 +27,8 @@ export default {
2627

2728
card: {
2829
boxShadow: "0 1.5rem 3.5rem rgba(0,0,0,0.1)",
29-
backgroundColor: "#fff",
30+
backgroundColor: ({ isDarkMode }) =>
31+
isDarkMode ? colors.darkPurple : "#fff",
3032
borderRadius: "1rem",
3133
padding: "3.5rem",
3234
width: "20%",

0 commit comments

Comments
 (0)