This repository was archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathPublishBlog.js
More file actions
178 lines (166 loc) · 4.42 KB
/
PublishBlog.js
File metadata and controls
178 lines (166 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import {
Button,
CircularProgress,
Container,
Divider,
Grid,
Hidden,
makeStyles,
Typography
} from '@material-ui/core';
import React, { useState } from 'react';
import { TextValidator, ValidatorForm } from 'react-material-ui-form-validator';
const useStyles = makeStyles(theme => ({
root: {
backgroundColor: '#fff',
padding: theme.spacing(20, 10, 20),
[theme.breakpoints.down('sm')]: {
padding: theme.spacing(20, 3, 20)
}
},
heading: {
fontWeight: 700,
paddingBottom: '20px'
},
paddingTop: {
paddingTop: '50px'
},
publish: {
color: '#585858',
paddingRight: '16px',
paddingBottom: '24px',
[theme.breakpoints.down('sm')]: {
paddingRight: '120px'
},
[theme.breakpoints.down('xs')]: {
paddingRight: '20px'
}
},
textField: {
marginBottom: '20px',
marginTop: '8px',
backgroundColor: '#ECECEC',
borderBlockColor: 'green',
borderColor: 'green',
'& .MuiOutlinedInput-notchedOutline': {
borderColor: '#ECECEC'
}
},
divider: {
backgroundColor: '#000',
padding: '0px 0.5px',
height: 'auto',
width: 'auto',
border: '0.5px #525252'
}
}));
export default function PublishBlog() {
const classes = useStyles();
return (
<div className={classes.root}>
<Container>
<Grid container spacing={3} justify="space-between">
<Grid item md={3}>
<Typography variant="h2" className={classes.heading}>
Publish Your Article In Our Publication
</Typography>
<Typography className={classes.publish}>
We promote all the old and new content that remains hidden from
the people. Aiming the new can only be discovered knowing the old
and the new.
</Typography>
</Grid>
<Hidden smDown>
<Divider
className={classes.divider}
variant="fullWidth"
orientation="vertical"
/>
</Hidden>
<Grid item md={7}>
<Typography variant="h2" className={classes.heading}>
Submit your blog link
</Typography>
<Typography
display="block"
variant="caption"
style={{ marginBottom: '20px' }}
>
It can be a link to blog on any blogging site which is not
published with other publication yet
</Typography>
<Form />
</Grid>
</Grid>
</Container>
</div>
);
}
function Form() {
const classes = useStyles();
const [formData, updateFormData] = useState({});
const [submitting, setSubmitting] = useState(0);
const handleChange = event => {
updateFormData({
...formData,
[event.target.name]: event.target.value
});
};
const handleSubmit = e => {
setSubmitting(1);
e.preventDefault();
formData.source = window.location.href;
};
return (
<div>
<ValidatorForm onSubmit={handleSubmit}>
<Typography variant="caption">Email Id</Typography>
<TextValidator
key="email"
className={classes.textField}
variant="outlined"
value={formData.email}
fullWidth
name="email"
onChange={handleChange}
validators={['required', 'isEmail']}
errorMessages={['This is a required field', 'Ender a valid Email']}
/>
<Typography variant="caption">Blog Link</Typography>
<TextValidator
key="link"
className={classes.textField}
variant="outlined"
value={formData.link}
fullWidth
name="link"
onChange={handleChange}
validators={['required']}
errorMessages={['This is a required field']}
/>
{submitting === 0 ? (
<Button
fullWidth
type="submit"
variant="contained"
color="secondary"
size="large"
style={{
marginTop: '12px',
textTransform: 'capitalize',
padding: '12px 0px'
}}
>
<Typography variant="h6" style={{ fontWeight: 600 }}>
Request
</Typography>
</Button>
) : (
<div className={classes.submissions}>
<CircularProgress />
</div>
)}
</ValidatorForm>
</div>
);
}