Skip to content

Commit 95f877c

Browse files
Add navbar
1 parent 54e07ac commit 95f877c

File tree

7 files changed

+97
-17
lines changed

7 files changed

+97
-17
lines changed

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1414
-->
1515
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
16-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
16+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap" rel="stylesheet">
1717

1818
<!--
1919
Notice the use of %PUBLIC_URL% in the tags above.

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CovidApp from "./components/CovidApp";
44

55
function App() {
66
return (
7-
<div className="App">
7+
<div>
88
<CovidApp />
99
</div>
1010
);

src/components/CovidApp.js

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
11
import React, { Component } from "react";
22
import Overview from "./Overview";
3+
import Navbar from "./Navbar";
4+
import { withStyles } from "@material-ui/styles";
5+
import colors from "../colors";
6+
7+
const styles = {
8+
root: {
9+
display: "flex",
10+
height: "100vh",
11+
},
12+
navBar: {
13+
flex: "0 0 10%",
14+
backgroundColor: colors.darkPurple,
15+
color: "#ffffff",
16+
textTransform: "capitalize",
17+
display: "flex",
18+
justifyContent: "center",
19+
},
20+
mainContent: {
21+
flex: 1,
22+
padding: "4rem",
23+
},
24+
heading: {
25+
fontWeight: "500",
26+
"& span": {
27+
color: colors.purple,
28+
fontWeight: "900",
29+
marginRight: "1rem",
30+
},
31+
},
32+
};
33+
34+
class CovidApp extends Component {
35+
constructor(props) {
36+
super(props);
37+
38+
this.state = {};
39+
}
340

4-
export default class CovidApp extends Component {
541
render() {
42+
const { classes } = this.props;
643
return (
7-
<div>
8-
<h1>Covid-19 India Trend</h1>
9-
<Overview />
44+
<div className={classes.root}>
45+
<div className={classes.navBar}>
46+
<Navbar />
47+
</div>
48+
<div className={classes.mainContent}>
49+
<h1 className={classes.heading}>
50+
<span>Covid-19</span> India Trend
51+
</h1>
52+
<Overview />
53+
</div>
1054
</div>
1155
);
1256
}
1357
}
58+
59+
export default withStyles(styles)(CovidApp);

src/components/DisplayPanels.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from "react";
22
import { withStyles } from "@material-ui/styles";
3+
import colors from "../colors";
34

45
const styles = {
56
panel: {
@@ -22,13 +23,13 @@ const styles = {
2223
let color;
2324
let title = props.title.toLowerCase();
2425
if (title === "recovered") {
25-
color = "green";
26+
color = colors.green;
2627
} else if (title === "deceased") {
27-
color = "purple";
28+
color = colors.purple;
2829
} else if (title === "active") {
29-
color = "orange";
30+
color = colors.orange;
3031
} else if (title === "confirmed") {
31-
color = "red";
32+
color = colors.red;
3233
}
3334
return color;
3435
},
@@ -41,13 +42,13 @@ const styles = {
4142
let color;
4243
let title = props.title.toLowerCase();
4344
if (title === "recovered") {
44-
color = "green";
45+
color = colors.green;
4546
} else if (title === "deceased") {
46-
color = "purple";
47+
color = colors.purple;
4748
} else if (title === "active") {
48-
color = "orange";
49+
color = colors.orange;
4950
} else if (title === "confirmed") {
50-
color = "red";
51+
color = colors.red;
5152
}
5253
return color;
5354
},

src/components/Navbar.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React, { Component } from "react";
2+
import { withStyles } from "@material-ui/styles";
3+
4+
const styles = {
5+
nav: {
6+
marginTop: "12rem",
7+
},
8+
navItems: {
9+
listStyle: "none",
10+
},
11+
navLinks: {
12+
marginBottom: "7rem",
13+
fontWeight: "500",
14+
},
15+
};
16+
17+
class Navbar extends Component {
18+
render() {
19+
const { classes } = this.props;
20+
return (
21+
<nav className={classes.nav}>
22+
<ul className={classes.navItems}>
23+
<li className={classes.navLinks}>Overview</li>
24+
<li className={classes.navLinks}>Symptoms</li>
25+
<li className={classes.navLinks}>Test Yourself</li>
26+
<li className={classes.navLinks}>Help</li>
27+
</ul>
28+
</nav>
29+
);
30+
}
31+
}
32+
33+
export default withStyles(styles)(Navbar);

src/components/Overview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { withStyles } from "@material-ui/styles";
55

66
const styles = {
77
root: {
8-
// display: "flex",
8+
textAlign: "center",
99
},
1010
panels: {
1111
display: "flex",
12-
justifyContent: "space-evenly",
12+
justifyContent: "space-between",
1313
alignItems: "center",
1414
},
1515
};

src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ html {
1313

1414

1515
body {
16-
margin: 0;
1716
font-family: 'Roboto',
1817
sans-serif;
1918

2019
-webkit-font-smoothing: antialiased;
2120
-moz-osx-font-smoothing: grayscale;
2221
font-size: 1.6rem;
22+
line-height: 1.7;
2323
background-color: rgba(185, 185, 185, 0.281);
2424
}
2525

0 commit comments

Comments
 (0)