-
Notifications
You must be signed in to change notification settings - Fork 96
Created a style file for each component #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,50 @@ | ||
import React, { useState, useContext } from 'react'; | ||
import React, { useState, useContext } from "react"; | ||
|
||
//material ui component | ||
import Container from '@material-ui/core/Container'; | ||
import Container from "@material-ui/core/Container"; | ||
import { | ||
Typography, | ||
Hidden, | ||
Grid, | ||
Button, | ||
CardContent | ||
} from '@material-ui/core'; | ||
import Card from '@material-ui/core/Card'; | ||
import { FormGroup } from '@material-ui/core'; | ||
import Divider from '@material-ui/core/Divider'; | ||
import '../style.css'; | ||
import { TwitterTimelineEmbed } from 'react-twitter-embed'; | ||
import Alert from '../Layouts/Alerts'; | ||
import AlertContext from '../../context/alert/alertContext'; | ||
import AuthContext from '../../context/auth/authContext'; | ||
import { backendUrl } from '../../context/types'; | ||
import axios from 'axios'; | ||
import SendIcon from '@material-ui/icons/Send'; | ||
CardContent, | ||
} from "@material-ui/core"; | ||
import Card from "@material-ui/core/Card"; | ||
import { FormGroup } from "@material-ui/core"; | ||
import Divider from "@material-ui/core/Divider"; | ||
import "../style.css"; | ||
import { TwitterTimelineEmbed } from "react-twitter-embed"; | ||
import Alert from "../Layouts/Alerts"; | ||
import AlertContext from "../../context/alert/alertContext"; | ||
import AuthContext from "../../context/auth/authContext"; | ||
import { backendUrl } from "../../context/types"; | ||
import axios from "axios"; | ||
import SendIcon from "@material-ui/icons/Send"; | ||
|
||
const sectionStyle = { | ||
width: '100%', | ||
|
||
backgroundRepeat: 'no-repeat', | ||
marginTop: '100px', | ||
backgroundPositionX: 'center', | ||
|
||
width: "100%", | ||
|
||
backgroundRepeat: "no-repeat", | ||
marginTop: "100px", | ||
backgroundPositionX: "center", | ||
}; | ||
const style = { | ||
form: { | ||
padding: '20px', | ||
padding: "20px", | ||
text: { | ||
appearance: 'none', | ||
width: '100%', | ||
appearance: "none", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these things should be in the separate CSS file of contacts components |
||
width: "100%", | ||
|
||
height: '35px', | ||
height: "35px", | ||
|
||
borderRadius: '5px', | ||
outline: 'none', | ||
border: 'none', | ||
background: '#e8ebed', | ||
color: '#576366', | ||
fontSize: '14px' | ||
} | ||
} | ||
borderRadius: "5px", | ||
outline: "none", | ||
border: "none", | ||
background: "#e8ebed", | ||
color: "#576366", | ||
fontSize: "14px", | ||
}, | ||
}, | ||
}; | ||
|
||
const Contactus = () => { | ||
|
@@ -56,91 +55,100 @@ const Contactus = () => { | |
const { error, loading, clearErrors, showLoading } = authContext; | ||
|
||
const [details, setDetails] = useState({ | ||
Firstname: '', | ||
Lastname: '', | ||
Email: '', | ||
Mobile: '', | ||
Reason: '' | ||
Firstname: "", | ||
Lastname: "", | ||
Email: "", | ||
Mobile: "", | ||
Reason: "", | ||
}); | ||
|
||
const { FirstName, LastName, Email, Mobile, Reason } = details; | ||
|
||
const handleChange = e => { | ||
const handleChange = (e) => { | ||
setDetails({ | ||
...details, | ||
[e.target.name]: e.target.value | ||
[e.target.name]: e.target.value, | ||
}); | ||
}; | ||
|
||
const submitContact = async e => { | ||
console.log('called submit contact'); | ||
const submitContact = async (e) => { | ||
console.log("called submit contact"); | ||
e.preventDefault(); | ||
showLoading({ data: true }); | ||
let contactData = { | ||
name: FirstName + ' ' + LastName, | ||
name: FirstName + " " + LastName, | ||
email: Email, | ||
contact: Mobile, | ||
query: Reason | ||
query: Reason, | ||
}; | ||
|
||
try { | ||
let res = await axios.post(backendUrl + '/api/contact', contactData); | ||
if (res.data.msg == 'Query submitted successfully') { | ||
setAlert(res.data.msg, 'success'); | ||
let res = await axios.post( | ||
backendUrl + "/api/contact", | ||
contactData | ||
); | ||
if (res.data.msg == "Query submitted successfully") { | ||
setAlert(res.data.msg, "success"); | ||
setDetails({ | ||
FirstName: '', | ||
LastName: '', | ||
Email: '', | ||
Mobile: '', | ||
Reason: '' | ||
FirstName: "", | ||
LastName: "", | ||
Email: "", | ||
Mobile: "", | ||
Reason: "", | ||
}); | ||
} else { | ||
setAlert(res.data.msg, 'danger'); | ||
setAlert(res.data.msg, "danger"); | ||
} | ||
clearErrors(); | ||
} catch (err) { | ||
console.log('Error:', err); | ||
console.log("Error:", err); | ||
setAlert( | ||
'Error occured while submitting your query.Please try again or write to us at [email protected]', | ||
'danger' | ||
"Error occured while submitting your query.Please try again or write to us at [email protected]", | ||
"danger" | ||
); | ||
clearErrors(); | ||
showLoading({ data: false }); | ||
} | ||
}; | ||
|
||
return ( | ||
<Container maxWidth='lg'> | ||
<Container maxWidth="lg"> | ||
<br /> | ||
<div style={sectionStyle}> | ||
<Grid | ||
container | ||
direction='row' | ||
justify='flex-start' | ||
alignItems='flex-start' | ||
direction="row" | ||
justify="flex-start" | ||
alignItems="flex-start" | ||
spacing={6} | ||
> | ||
<Grid direction='row' xs={12} sm={12} md={6} style={{padding:"20px"}}> | ||
<Grid | ||
direction="row" | ||
xs={12} | ||
sm={12} | ||
md={6} | ||
style={{ padding: "20px" }} | ||
> | ||
<Card | ||
className='card--shadow' | ||
style={{ borderRadius: '10px', }} | ||
className="card--shadow" | ||
style={{ borderRadius: "10px" }} | ||
> | ||
<div style={{ backgroundColor: '#24292E' }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't want double-quotes. Move this CSS in separate file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Calm down |
||
<div style={{ backgroundColor: "#24292E" }}> | ||
<br /> | ||
<CardContent> | ||
<Hidden smUp> | ||
<Typography | ||
variant='h4' | ||
className='contact_section_heading' | ||
variant="h4" | ||
className="contact_section_heading" | ||
> | ||
Get in touch | ||
</Typography> | ||
</Hidden> | ||
|
||
<Hidden mdDown> | ||
<Typography | ||
variant='h3' | ||
className='contact_section_heading' | ||
variant="h3" | ||
className="contact_section_heading" | ||
> | ||
Get in touch | ||
</Typography> | ||
|
@@ -150,7 +158,7 @@ const Contactus = () => { | |
<Divider /> | ||
<br /> | ||
<div style={style.form}> | ||
<form autoComplete='on'> | ||
<form autoComplete="on"> | ||
<Grid container spacing={3}> | ||
<Grid item xs={12}> | ||
<Alert /> | ||
|
@@ -160,8 +168,8 @@ const Contactus = () => { | |
<label>First-Name</label> | ||
<input | ||
style={style.form.text} | ||
type='text' | ||
name='FirstName' | ||
type="text" | ||
name="FirstName" | ||
value={FirstName} | ||
onChange={handleChange} | ||
/> | ||
|
@@ -172,8 +180,8 @@ const Contactus = () => { | |
<label>Last-Name</label> | ||
<input | ||
style={style.form.text} | ||
type='text' | ||
name='LastName' | ||
type="text" | ||
name="LastName" | ||
value={LastName} | ||
onChange={handleChange} | ||
/> | ||
|
@@ -184,8 +192,8 @@ const Contactus = () => { | |
<label>Email</label> | ||
<input | ||
style={style.form.text} | ||
type='email' | ||
name='Email' | ||
type="email" | ||
name="Email" | ||
value={Email} | ||
onChange={handleChange} | ||
/> | ||
|
@@ -194,8 +202,8 @@ const Contactus = () => { | |
<label>Contact Number</label> | ||
<input | ||
style={style.form.text} | ||
type='tel' | ||
name='Mobile' | ||
type="tel" | ||
name="Mobile" | ||
value={Mobile} | ||
onChange={handleChange} | ||
/> | ||
|
@@ -204,16 +212,16 @@ const Contactus = () => { | |
<label>Query</label> | ||
<input | ||
style={style.form.text} | ||
type='textarea' | ||
name='Reason' | ||
type="textarea" | ||
name="Reason" | ||
value={Reason} | ||
onChange={handleChange} | ||
/> | ||
</FormGroup> | ||
<br /> | ||
<Typography className='align_center'> | ||
<Typography className="align_center"> | ||
<Button | ||
variant='contained' | ||
variant="contained" | ||
color="primary" | ||
onClick={submitContact} | ||
disabled={loading} | ||
|
@@ -227,12 +235,15 @@ const Contactus = () => { | |
</Card> | ||
</Grid> | ||
<Grid item xs={12} sm={6} md={6}> | ||
<Card style={{ borderRadius: '10px', fontSize: '14px' }} className="card--shadow"> | ||
<Card | ||
style={{ borderRadius: "10px", fontSize: "14px" }} | ||
className="card--shadow" | ||
> | ||
Comment on lines
-230
to
+241
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nothing is changed in these lines |
||
<TwitterTimelineEmbed | ||
sourceType='profile' | ||
screenName='technojam_gu' | ||
sourceType="profile" | ||
screenName="technojam_gu" | ||
options={{ height: 475 }} | ||
size='20px' | ||
size="20px" | ||
/> | ||
</Card> | ||
</Grid> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what you have changed here