-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
9bf3a7b
commit 4a51b9d
Showing
4 changed files
with
132 additions
and
74 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,51 +1,52 @@ | ||
{ | ||
"name": "barscapes", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@testing-library/user-event": "^13.5.0", | ||
"express": "^4.18.2", | ||
"express-graphql": "^0.12.0", | ||
"graph": "^0.2.0", | ||
"ql": "^0.1.5", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.2.1", | ||
"react-scripts": "^5.0.1", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
"private": true, | ||
"dependencies": { | ||
"@apollo/client": "^3.7.5", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@testing-library/user-event": "^13.5.0", | ||
"express": "^4.18.2", | ||
"express-graphql": "^0.12.0", | ||
"graph": "^0.2.0", | ||
"ql": "^0.1.5", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.2.1", | ||
"react-scripts": "^5.0.1", | ||
"web-vitals": "^2.1.4" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"nodemon": "^2.0.20", | ||
"tailwind": "^4.0.0" | ||
"nodemon": "^2.0.20", | ||
"tailwind": "^4.0.0" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,68 +1,107 @@ | ||
import React from 'react' | ||
import React, {useState} from 'react' | ||
import drunkBee from '../assets/images/drunkbee.png' | ||
import signupPhoto from '../assets/images/signup.png' | ||
import { Link } from 'react-router-dom'; | ||
import { useMutation } from '@apollo/client'; | ||
import { ADD_USER } from '../utils/mutations'; | ||
|
||
export default function Signup() { | ||
function Signup() { | ||
|
||
|
||
const [formState, setFormState] = useState({ | ||
username: '', | ||
email: '', | ||
password: '', | ||
}); | ||
const [addUser] = useMutation(ADD_USER); | ||
|
||
const handleChange = (event) => { | ||
const { name, value } = event.target; | ||
|
||
setFormState({ | ||
...formState, | ||
[name]: value, | ||
}); | ||
}; | ||
|
||
const handleFormSubmit = async (event) => { | ||
event.preventDefault(); | ||
console.log(formState); | ||
|
||
try { | ||
const { data } = await addUser({ | ||
variables: { ...formState }, | ||
}); | ||
|
||
Auth.login(data.addUser.token); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
}; | ||
|
||
|
||
return ( | ||
<div class="create-account bg-yellow-200 container"> | ||
<div className="create-account bg-yellow-200 container"> | ||
|
||
<form> | ||
<form onSubmit={handleFormSubmit}> | ||
<br></br><br></br> | ||
<img class ="mx-auto outline" src={drunkBee} alt="Drunk bee" width="300" height="350"/><br></br> | ||
<div class="input-1 text-2xl font md:font-serif pl-7 pt-34 text-center font-bold"> | ||
<img className ="mx-auto outline" src={drunkBee} alt="Drunk bee" width="300" height="350"/><br></br> | ||
<div className="input-1 text-2xl font md:font-serif pl-7 pt-34 text-center font-bold"> | ||
<label> | ||
First Name: | ||
<input class ="bg-black text-white pl-7"type="text" name="name" placeholder="" /> | ||
<input className ="bg-black text-white pl-7"type="text" name="name" placeholder="" /> | ||
</label> | ||
</div> | ||
|
||
<br></br><br></br> | ||
<div class="input-2 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
<div className="input-2 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
|
||
|
||
<label> | ||
Last Name: | ||
<input class ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
<input className ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
</label> | ||
</div> | ||
|
||
<br></br><br></br> | ||
|
||
<div class="input-3 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
<div className="input-3 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
|
||
<label> | ||
Email: | ||
<input class ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
<input onChange={handleChange} className ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
</label> | ||
</div> | ||
|
||
<br></br><br></br> | ||
|
||
<div class="input-4 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
<div className="input-4 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
|
||
<label> | ||
Password: | ||
<input class ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
<input onChange={handleChange} className ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
</label> | ||
</div> | ||
|
||
<br></br><br></br> | ||
|
||
<div class="input-5 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
<div className="input-5 text-2xl md:font-serif pl-7 text-center font-bold"> | ||
|
||
<label> | ||
Confirm Password: | ||
<input class ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
<input onChange={handleChange} className ="bg-black text-white" type="text" name="name" placeholder="" /> | ||
</label> | ||
</div> | ||
|
||
<br></br><br></br> | ||
|
||
</form> | ||
<div class="log-in text-3xl md:font-serif pb-24 underline animate-pulse text-center font-bold"> | ||
<button class="button text-2xl md:font-serif text-center" type="button"><Link to="/pages/comment">Click here to submit!</Link></button> | ||
|
||
<div className="log-in text-3xl md:font-serif pb-24 underline animate-pulse text-center font-bold"> | ||
<button className="button text-2xl md:font-serif text-center" type="submit"><Link to="/pages/comment">Click here to submit!</Link></button> | ||
|
||
</div> | ||
</form> | ||
</div> | ||
) | ||
} | ||
export default Signup |