Skip to content

Commit 872f515

Browse files
Add updates
1 parent b3fe152 commit 872f515

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

src/components/CovidApp.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from "react";
2-
import { formatDistance, format } from "date-fns";
2+
import { formatDistance } from "date-fns";
33
import Overview from "./Overview";
44
import { withStyles } from "@material-ui/styles";
55
import colors from "../constants/colors";
@@ -19,7 +19,7 @@ import Barchart from "./Barchart";
1919
import stateCodes from "../constants/stateCodes";
2020
import Lottie from "react-lottie";
2121
import * as animationData from "../assets/loading.json";
22-
import FadeIn from "react-fade-in";
22+
// import FadeIn from "react-fade-in";
2323
import Footer from "./Footer";
2424

2525
const defaultOptions = {
@@ -151,26 +151,27 @@ class CovidApp extends Component {
151151
.map(({ update, timestamp }, i) => {
152152
update = update.replace("\n", "<br/>");
153153
return (
154-
<React.Fragment key={i}>
155-
<h5>
154+
<div className={classes.updateBox} key={i}>
155+
<h5 className={classes.updateHeading}>
156156
{`${formatDistance(
157157
new Date(timestamp * 1000),
158158
new Date()
159159
)} ago`}
160160
</h5>
161161
<h4
162+
className={classes.updateText}
162163
dangerouslySetInnerHTML={{
163164
__html: update,
164165
}}
165166
></h4>
166-
</React.Fragment>
167+
</div>
167168
);
168169
});
169170
} catch (err) {}
170171

171172
return (
172173
<>
173-
<div className={classes.header} style={{ zIndex: "999" }}>
174+
<div className={classes.header}>
174175
<h1 className={classes.heading}>
175176
<span>Covid-19</span> India Trend
176177
</h1>
@@ -197,7 +198,7 @@ class CovidApp extends Component {
197198
</div>
198199
)}
199200
</div>
200-
<div className={classes.update}>{expanded && displayUpdates}</div>
201+
{expanded && <div className={classes.update}>{displayUpdates}</div>}
201202
</div>
202203
<div className="darkModeButton">
203204
<label className="switch">
@@ -210,7 +211,7 @@ class CovidApp extends Component {
210211
</label>
211212
</div>
212213
</div>
213-
<div style={{ position: "relative", zIndex: "-1" }}>
214+
<div>
214215
<Overview
215216
isDarkMode={isDarkMode}
216217
data={this.state.todayData}

src/styles/CovidAppStyles.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ export default {
3939
fontSize: "3rem",
4040
color: colors.darkPurple,
4141
position: "relative",
42-
transition: "all .5s ease",
42+
transition: "all .4s ease",
43+
44+
"&:hover": {
45+
transform: "scale(1.15)",
46+
color: "#000",
47+
},
4348
},
4449

4550
notificationBell: {
@@ -58,11 +63,27 @@ export default {
5863
},
5964

6065
update: {
66+
fontSize: "1.5rem",
6167
display: "block",
6268
position: "absolute",
6369
left: "-25rem",
64-
backgroundColor: "red",
65-
zIndex: "99999999",
70+
backgroundColor: "rgba(255,255,255,.95)",
71+
borderRadius: "2rem",
72+
boxShadow: "0 1rem 2rem rgba(0,0,0,.15)",
73+
padding: "3rem",
74+
zIndex: "1",
75+
transition: "all .5s",
76+
},
77+
78+
updateBox: {
79+
marginBottom: "1.5rem",
80+
},
81+
82+
updateHeading: {
83+
textTransform: "capitalize",
84+
},
85+
updateText: {
86+
fontWeight: "400",
6687
},
6788

6889
content: {

0 commit comments

Comments
 (0)