Skip to content

Commit 89246cb

Browse files
Changes css to css in js
1 parent 0c29e20 commit 89246cb

File tree

7 files changed

+58
-47
lines changed

7 files changed

+58
-47
lines changed

src/components/CovidApp.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
faBell,
33
faBellSlash,
4-
faSyncAlt,
4+
faSyncAlt
55
} from "@fortawesome/free-solid-svg-icons";
66
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
77
import { withStyles } from "@material-ui/styles";
@@ -144,7 +144,7 @@ class CovidApp extends Component {
144144
const month = date.slice(3, 5);
145145
const time = date.slice(11);
146146
return `${day} ${months[month]}, ${time.slice(0, 5)} IST`;
147-
} catch (err) {}
147+
} catch (err) { }
148148
}
149149

150150
render() {
@@ -189,7 +189,7 @@ class CovidApp extends Component {
189189
</div>
190190
);
191191
});
192-
} catch (err) {}
192+
} catch (err) { }
193193

194194
return (
195195
<>
@@ -216,13 +216,13 @@ class CovidApp extends Component {
216216
onClick={this.handleNotification}
217217
/>
218218
) : (
219-
<div className={classes.notificationBell}>
220-
<FontAwesomeIcon
221-
icon={faBell}
222-
onClick={this.handleNotification}
223-
/>
224-
</div>
225-
)}
219+
<div className={classes.notificationBell}>
220+
<FontAwesomeIcon
221+
icon={faBell}
222+
onClick={this.handleNotification}
223+
/>
224+
</div>
225+
)}
226226
</div>
227227
{expanded && <div className={classes.update}>{displayUpdates}</div>}
228228
</div>

src/components/LinearGradient.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
import React from "react";
22
import PropTypes from "prop-types";
3-
import "../styles/LinearGradient.css";
3+
import styles from "../styles/LinearGradientStyles";
4+
import { withStyles } from "@material-ui/styles";
5+
import classNames from 'classnames'
46

57
const LinearGradient = (props) => {
6-
const { data } = props;
7-
const boxStyle = {
8-
width: 180,
9-
margin: "auto",
10-
};
11-
const gradientStyle = {
12-
backgroundImage: `linear-gradient(to right, ${data.fromColor} , ${data.toColor})`,
13-
height: 20,
14-
};
8+
const { data, classes } = props;
159
return (
1610
<div>
17-
<div style={boxStyle} className="display-flex">
11+
<div className={classNames(classes.boxStyle, classes.displayFlex)}>
1812
<span>{data.min}</span>
19-
<span className="fill"></span>
13+
<span className={classes.fill}></span>
2014
<span>{data.max}</span>
2115
</div>
22-
<div style={{ ...boxStyle, ...gradientStyle }} className="mt8"></div>
16+
<div className={classNames(classes.mt8, classes.boxStyle, classes.gradientStyle)}></div>
2317
</div>
2418
);
2519
};
@@ -28,4 +22,4 @@ LinearGradient.propTypes = {
2822
data: PropTypes.object.isRequired,
2923
};
3024

31-
export default LinearGradient;
25+
export default withStyles(styles)(LinearGradient);

src/components/Map.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { scaleQuantile } from "d3-scale";
44
import ReactTooltip from "react-tooltip";
55
import LinearGradient from "./LinearGradient.js";
66
import INDIA_TOPO_JSON from "../constants/india.topo.json";
7-
import "../styles/Map.css"
7+
import "../styles/MapStyles.js"
8+
import { withStyles } from "@material-ui/styles";
9+
import styles from '../styles/MapStyles'
810

911
/**
1012
* Courtesy: https://rawgit.com/Anujarya300/bubble_maps/master/data/geography-data/india.topo.json
@@ -76,6 +78,7 @@ class Map extends Component {
7678

7779
render() {
7880
const data = this.props.mapData;
81+
const { classes } = this.props
7982
const gradientData = {
8083
fromColor: COLOR_RANGE[0],
8184
toColor: COLOR_RANGE[COLOR_RANGE.length - 1],
@@ -121,4 +124,4 @@ class Map extends Component {
121124
}
122125
}
123126

124-
export default Map;
127+
export default withStyles(styles)(Map);

src/styles/LinearGradient.css

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/styles/LinearGradientStyles.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default {
2+
displayFlex: {
3+
display: "flex",
4+
},
5+
6+
boxStyle: {
7+
width: "180px",
8+
margin: "auto",
9+
},
10+
11+
gradientStyle: {
12+
backgroundImage: (props) => `linear-gradient(to right, ${props.data.fromColor} , ${props.data.toColor})`,
13+
height: "20px",
14+
},
15+
16+
fill: {
17+
flex: 1,
18+
},
19+
20+
center: {
21+
textAlign: "center",
22+
},
23+
24+
mt16: {
25+
marginTop: "16px",
26+
},
27+
}

src/styles/Map.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/styles/MapStyles.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default {
2+
container: {
3+
backgroundColor: "rgba(129, 124, 155, 0.05)",
4+
padding: "3rem",
5+
borderRadius: "2.5rem",
6+
width: "100%",
7+
}
8+
}

0 commit comments

Comments
 (0)