-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implemented Tailwind / Added Forms #48
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a589ca5
Add user TS interfaces
31d1c83
Add new form components
a3a20a4
Add proper forms and routing
fab28fd
Clean up code for readability
3ac2614
Implement correct routing to proper pages
29c70b4
Implement TailwindCSS
be13c53
Implemented Tailwind to add forms, updated GeoJSON
a0750a8
Remove navigation for deployment
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,4 @@ | |
flex-direction: column; | ||
font-family: "Satisfy", cursive; | ||
justify-content: space-between; | ||
padding-bottom: 5rem; | ||
} |
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,52 +1,58 @@ | ||
import React, { useState } from 'react'; | ||
import React, { useState } from "react"; | ||
import { NewUser } from "../../apiTypes"; | ||
import './CreateAcctForm.css'; | ||
import { useNavigate } from "react-router-dom"; | ||
import "./CreateAcctForm.css"; | ||
|
||
function CreateAcctForm() { | ||
const [formData, setFormData] = useState<NewUser>({ name: '', email: '', password: '' }) | ||
const navigate = useNavigate(); | ||
const [formData, setFormData] = useState<NewUser>({ | ||
name: "", | ||
email: "", | ||
password: "", | ||
}); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { name, value } = event.target | ||
setFormData({ ...formData, [name]: value }) | ||
}; | ||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { name, value } = event.target; | ||
setFormData({ ...formData, [name]: value }); | ||
}; | ||
|
||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault() | ||
// console.log(formData) | ||
}; | ||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
// console.log(formData) | ||
}; | ||
|
||
return ( | ||
<div className="acct-form-container"> | ||
<h2>Create Account</h2> | ||
<form onSubmit={handleSubmit}> | ||
<input | ||
type="text" | ||
name="name" | ||
placeholder="Name" | ||
value={formData.name} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="email" | ||
name="email" | ||
placeholder="Email" | ||
value={formData.email} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="password" | ||
name="password" | ||
placeholder="Password" | ||
value={formData.password} | ||
onChange={handleChange} | ||
required | ||
/> | ||
return ( | ||
<div className="acct-form-container"> | ||
<h2>Create Account</h2> | ||
<form onSubmit={handleSubmit}> | ||
<input | ||
type="text" | ||
name="name" | ||
placeholder="Name" | ||
value={formData.name} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="email" | ||
name="email" | ||
placeholder="Email" | ||
value={formData.email} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="password" | ||
name="password" | ||
placeholder="Password" | ||
value={formData.password} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</div> | ||
) | ||
); | ||
} | ||
|
||
export default CreateAcctForm; | ||
export default CreateAcctForm; |
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 |
---|---|---|
|
@@ -58,4 +58,4 @@ | |
width: 80%; | ||
max-width: 500px; | ||
} | ||
} | ||
} |
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,44 +1,58 @@ | ||
import React, { useState } from 'react'; | ||
import React, { useState } from "react"; | ||
import { UserCredentials } from "../../apiTypes"; | ||
import './LoginForm.css'; | ||
import { useNavigate } from "react-router-dom"; | ||
import "./LoginForm.css"; | ||
|
||
function LoginForm() { | ||
const [credentials, setCredentials] = useState<UserCredentials>({ email: '', password: '' }); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { name, value } = event.target; | ||
setCredentials({ ...credentials, [name]: value }) | ||
}; | ||
|
||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault() | ||
const navigate = useNavigate(); | ||
|
||
const [credentials, setCredentials] = useState<UserCredentials>({ | ||
email: "", | ||
password: "", | ||
}); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { name, value } = event.target; | ||
setCredentials({ ...credentials, [name]: value }); | ||
}; | ||
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. Great job implementing this with TS! |
||
|
||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
// console.log(credentials) | ||
}; | ||
|
||
return ( | ||
<div className="login-form-container"> | ||
<h2>Login</h2> | ||
<form onSubmit={handleSubmit}> | ||
<input | ||
type="email" | ||
name="name" | ||
placeholder="Email" | ||
value={credentials.email} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="password" | ||
name="password" | ||
placeholder="Password" | ||
value={credentials.password} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<button type="submit">Submit</button> | ||
</form> | ||
</div> | ||
) | ||
} | ||
|
||
export default LoginForm; | ||
}; | ||
|
||
return ( | ||
<div className="login-form-container"> | ||
<h2>Login</h2> | ||
<form onSubmit={handleSubmit}> | ||
<input | ||
type="email" | ||
name="email" | ||
placeholder="Email" | ||
value={credentials.email} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<input | ||
type="password" | ||
name="password" | ||
placeholder="Password" | ||
value={credentials.password} | ||
onChange={handleChange} | ||
required | ||
/> | ||
<button type="submit">Submit</button> | ||
|
||
<button | ||
type="button" | ||
onClick={() => navigate("/create-account")} | ||
className="sign-up-button" | ||
> | ||
New user? Sign up here | ||
</button> | ||
</form> | ||
</div> | ||
); | ||
} | ||
|
||
export default LoginForm; |
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 |
---|---|---|
@@ -1,34 +1,36 @@ | ||
.map-container { | ||
width: 100%; | ||
height: 60vh; | ||
border-radius: 1.5rem; | ||
overflow: hidden; | ||
|
||
width: 100%; | ||
height: 60vh; | ||
border-radius: 1.5rem; | ||
overflow: hidden; | ||
} | ||
|
||
.map-background { | ||
margin-top: 4rem; | ||
background-color: #f0a202; | ||
padding: 1.5rem; | ||
border-radius: 1.5rem; | ||
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15); | ||
width: 60%; | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 1rem; | ||
background-color: #f0a202; | ||
padding: 1.5rem; | ||
border-radius: 1.5rem; | ||
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15); | ||
width: 60%; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
/* SMALL BREAKPOINT */ | ||
@media screen and (max-width: 750px) { | ||
.map-background { | ||
margin-bottom: 10rem; | ||
width: 95%; | ||
} | ||
} | ||
|
||
.map-background { | ||
margin-bottom: 10rem; | ||
width: 95%; | ||
} | ||
|
||
.map-container { | ||
height: 50vh; /* Adjust for smaller devices */ | ||
} | ||
} | ||
|
||
/* MEDIUM BREAKPOINT (altered for map filling container) */ | ||
@media screen and (max-width: 1195px) and (min-width: 750px) { | ||
.map-background { | ||
width: 90%; | ||
|
||
} | ||
} | ||
.map-background { | ||
width: 90%; | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This will be a merge conflict with the working code on my branch but since my styling has all migrated to the inline JSX with Tailwind, it should be easy to reconcile. If we need to change the font and margin top, we can adjust as needed.