Skip to content

Commit f5c7d38

Browse files
Style Form
1 parent eb29e8f commit f5c7d38

File tree

4 files changed

+57
-17
lines changed

4 files changed

+57
-17
lines changed

src/components/Form.js

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

3-
export default class Form extends Component {
5+
class Form extends Component {
46
constructor(props) {
57
super(props);
68

@@ -22,18 +24,22 @@ export default class Form extends Component {
2224
}
2325

2426
render() {
27+
const { classes } = this.props;
2528
return (
2629
<form onSubmit={this.handleSubmit}>
2730
<input
31+
className={classes.input}
2832
name="location"
2933
type="text"
3034
value={this.state.location}
3135
placeholder="Enter any location"
3236
onChange={this.handleChange}
3337
required
3438
/>
35-
<button>Get Help</button>
39+
<button className={classes.btn}>Get Help</button>
3640
</form>
3741
);
3842
}
3943
}
44+
45+
export default withStyles(styles)(Form);

src/components/Help.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Form from "./Form";
55
import axios from "axios";
66
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
77
import { faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
8+
import FadeIn from "react-fade-in";
89

910
class Help extends Component {
1011
constructor(props) {
@@ -62,7 +63,7 @@ class Help extends Component {
6263
}
6364
}
6465
}
65-
this.setState({ currentResources: resources });
66+
this.setState({ currentResources: resources, isLoading: false });
6667
}
6768

6869
render() {
@@ -73,7 +74,7 @@ class Help extends Component {
7374
for (const key2 in object[key]) {
7475
if (object[key].hasOwnProperty(key2)) {
7576
const result = object[key][key2].map((resource) => (
76-
<div
77+
<FadeIn
7778
key={resource.phonenumber.split(0, 5)}
7879
className={classes.card}
7980
>
@@ -99,7 +100,7 @@ class Help extends Component {
99100
Contact: {resource.phonenumber}
100101
</p>
101102
</div>
102-
</div>
103+
</FadeIn>
103104
));
104105
return result;
105106
}
@@ -119,15 +120,3 @@ class Help extends Component {
119120
}
120121

121122
export default withStyles(styles)(Help);
122-
123-
// 0:
124-
// Gangtok:
125-
// CoVID-19 Testing Lab: Array(1)
126-
// 0:
127-
// category: "CoVID-19 Testing Lab"
128-
// city: "Gangtok"
129-
// contact: "https://covid.icmr.org.in/index.php/testing-labs-deatails#"
130-
// descriptionandorserviceprovided: "Collection Site Only"
131-
// nameoftheorganisation: "Sir Thutob Namgyal Memorial (STNM)"
132-
// phonenumber: "9845562399"
133-
// state: "Sikkim"

src/styles/FormStyles.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export default {
2+
input: {
3+
fontFamily: "inherit",
4+
fontSize: "1.6rem",
5+
border: "none",
6+
padding: "1.5rem 3rem",
7+
width: "20%",
8+
borderRadius: "2.5rem",
9+
margin: "1.5rem",
10+
transition: "all .4s",
11+
12+
"&:focus": {
13+
width: "22%",
14+
outline: "none",
15+
},
16+
17+
"&::placeholder": {
18+
color: "#bbb",
19+
},
20+
},
21+
22+
btn: {
23+
"&, &:active": {
24+
fontFamily: "inherit",
25+
fontSize: "1.4rem",
26+
padding: "1.5rem 2rem",
27+
backgroundColor: "#1A1053",
28+
color: "#fff",
29+
borderRadius: "2.5rem",
30+
border: "none",
31+
outline: "none",
32+
transition: "all .4s",
33+
transform: "translateY(-2px)",
34+
boxShadow: "0 .5rem 1rem rgba(0,0,0,0.2)",
35+
},
36+
37+
"&:hover": {
38+
backgroundColor: "#000",
39+
cursor: "pointer",
40+
transform: "translateY(0)",
41+
outline: "none",
42+
},
43+
},
44+
};

src/styles/HelpStyles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
display: "flex",
2121
margin: "2rem 0",
2222
flexDirection: "column",
23+
textAlign: "left",
2324
},
2425

2526
header: {

0 commit comments

Comments
 (0)