Skip to content

Commit

Permalink
Merge pull request #11 from elric97/fix/revert_changes
Browse files Browse the repository at this point in the history
Fix/revert changes
  • Loading branch information
elric97 authored Nov 24, 2021
2 parents 9cdff2e + 72aaaab commit f9c6202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 73 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Feature Hunt </title>
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
80 changes: 8 additions & 72 deletions src/Components/ProjectForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import React from 'react';
import { ReactSession } from "react-client-session";
import styled from "styled-components";
import TextField from "@mui/material/TextField";
import Button from '@mui/material/Button';
import Service from "../Service";
import FilledInput from '@mui/material/FilledInput';
import InputLabel from '@mui/material/InputLabel';
import InputAdornment from '@mui/material/InputAdornment';
import FormControl from '@mui/material/FormControl';

const Styles = styled.div`
background: #218888;
Expand All @@ -17,7 +12,7 @@ const Styles = styled.div`
border-bottom: 1px solid white;
color: #6f6f6f;
font-family: sans-serif;
font-size: 30px;
font-size: 20px;
font-weight: 600;
line-height: 24px;
padding: 10px;
Expand All @@ -27,14 +22,12 @@ const Styles = styled.div`
form {
background: white;
border: 1px solid #dedede;
border-radius: 30px;
display: flex;
flex-direction: column;
justify-content: space-around;
margin: 0 auto;
max-width: 1000px;
padding: 20px 100px;
padding-bottom: 60px;
padding: 50px 200px;
}
input {
Expand All @@ -52,7 +45,6 @@ const Styles = styled.div`
font-size: 14px;
font-weight: 500;
margin-bottom: 5px;
width: 100%;
}
.error {
Expand All @@ -68,13 +60,6 @@ const Styles = styled.div`
font-family: sans-serif;
font-size: 14px;
margin: 20px 0px;
}
Button{
background-color: #218888;
}
`;

//
Expand All @@ -92,8 +77,6 @@ function ProjectForm() {
const [message, setMessage] = React.useState("");
const [user, setUser] = React.useState([""]);
const [tags, setTags] = React.useState("");
const [country, setCountry] = React.useState("");
const [funding, setFunding] = React.useState("");

React.useEffect(() => {
setUser(ReactSession.get("username"));
Expand All @@ -115,22 +98,11 @@ function ProjectForm() {
setTags(e.target.value);
}

const handleLaunchCountryChange = (e) => {
setCountry(e.target.value);
}

const handleFundingChange = (e) => {
setFunding(e.target.value);
}


const handleSubmit = (event) => {
const form = new FormData();
form.append("productName", name);
form.append("productDescription", description);
form.append("lauchCountry", country);
form.append("imageUrl", imageURL);
form.append("initialFunding", imageURL);
form.append("email", user);
form.append("tags", tags);
Service.post("addProduct", form)
Expand All @@ -157,22 +129,18 @@ function ProjectForm() {
<label>Name</label>
<TextField
data-testid="form_name"
id="name"
label=""
multiline
maxRows={1}
inputProps={{ "data-testid": "form-inputName" }}
value={name}
onChange={handleNameChange}
fullWidth
id="filled-basic"
variant="filled"
style={{ color:'#218888'}}
/>
<br />
<label>Description</label>
<TextField
id="filled-basic"
variant="filled"
id="description"
label=""
multiline
rows={3}
Expand All @@ -181,24 +149,9 @@ function ProjectForm() {
onChange={handleDescriptionChange}
fullWidth
/>
<br />
<label>Country of launch</label>
<TextField
id="filled-basic"
variant="filled"
label=""
multiline
rows={1}
inputProps={{ "data-testid": "form-Desc" }}
value={country}
onChange={handleLaunchCountryChange}
fullWidth
/>
<br />
<label>Image URL</label>
<TextField
id="filled-basic"
variant="filled"
id="imageURL"
label=""
multiline
maxRows={1}
Expand All @@ -207,23 +160,9 @@ function ProjectForm() {
onChange={handleImageURLChange}
fullWidth
/>
<br />
<label>Initial Funding</label>
<FormControl fullWidth variant="filled">
<FilledInput
id="filled-adornment-amount"
value={funding}
onChange={handleFundingChange}
startAdornment={<InputAdornment>$</InputAdornment>}
multiline
maxRows={1}
/>
</FormControl>
<br />
<label>Tags</label>
<TextField
id="filled-basic"
variant="filled"
id="tags"
label=""
multiline
maxRows={1}
Expand All @@ -232,11 +171,8 @@ function ProjectForm() {
onChange={handleTagsChange}
fullWidth
/>
<br /><br />
<Button variant="contained" size="large" data-testid="submit_button" onClick={handleSubmit} >
Submit
</Button>
{/* <button data-testid="submit_button" onClick={handleSubmit}>Submit</button> */}

<button data-testid="submit_button" onClick={handleSubmit}>Submit</button>
</form>
</div>
);
Expand Down

0 comments on commit f9c6202

Please sign in to comment.