-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aayushshah196
committed
Jul 7, 2022
1 parent
266535b
commit 5126207
Showing
5 changed files
with
100 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { useState } from 'react'; | ||
import { styled } from '@mui/material/styles'; | ||
import Box from '@mui/material/Box'; | ||
import Button from '@mui/material/Button'; | ||
import TextField from '@mui/material/TextField'; | ||
import Grid from '@mui/material/Grid'; | ||
|
||
const Input = styled('input')({ | ||
display: 'none', | ||
}); | ||
|
||
export default function CandidateForm(){//({role, contract, web3, currentAccount}) { | ||
const [name, setName] = useState(''); | ||
const [file, setFile] = useState(null); | ||
|
||
const handleForm = async () => { | ||
console.log("handleForm"); | ||
await contract.methods.addCandidate(name).call(); | ||
} | ||
|
||
const handleNameChange = (event) => { | ||
setName(event.target.value); | ||
}; | ||
|
||
const handleFileChange = (event) => { | ||
setFile(event.target.files[0]); | ||
}; | ||
|
||
return( | ||
<Box> | ||
<Grid container spacing={3}> | ||
|
||
<Grid item xs={12}> | ||
Candidate Form | ||
</Grid> | ||
|
||
<Grid item xs={12}> | ||
<label htmlFor="contained-button-file"> | ||
<Input accept="image/*" id="contained-button-file" onChange={handleFileChange}/> | ||
<Button variant="contained" component="span"> | ||
Upload Candidate List | ||
</Button> | ||
</label> | ||
</Grid> | ||
|
||
<Grid item xs={12}> | ||
<form onSubmit={handleForm}> | ||
<TextField | ||
id="outlined-basic" | ||
label="Candidate Name" | ||
variant="outlined" | ||
value={name} | ||
onChange={handleNameChange} | ||
/> | ||
<Button variant="contained" type="submit"> Submit </Button> | ||
</form> | ||
</Grid> | ||
|
||
</Grid> | ||
|
||
</Box> | ||
|
||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters