-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
7 changed files
with
214 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Head from 'next/head'; | ||
import Login from '@/components/OpportunityForm'; | ||
import Opportunities from '../opportunities/page'; | ||
|
||
export default function LoginPage() { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Create Opportunity</title> | ||
</Head> | ||
<h1>Create Opportunity</h1> | ||
<Opportunities /> | ||
</> | ||
); | ||
} |
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,161 @@ | ||
import { useState } from "react"; | ||
import { PetCardProps, ShelterProp } from "./Props"; | ||
export default function Form(shelters: ShelterProp[]) { | ||
const [formData, setFormData] = useState({} as PetCardProps); | ||
|
||
const handleChange = (event: any) => { | ||
setFormData({ | ||
...formData, | ||
[event.target.name]: event.target.value, | ||
}); | ||
}; | ||
|
||
const handleSubmit = (event: any) => { | ||
event.preventDefault(); | ||
console.log(formData) | ||
}; | ||
|
||
return ( | ||
<form onSubmit={handleSubmit} className="p-4 bg-white rounded shadow"> | ||
<div className="mb-4"> | ||
<label htmlFor="type" className="block text-gray-700 font-medium mb-2"> | ||
Type | ||
</label> | ||
<input | ||
type="text" | ||
name="type" | ||
id="type" | ||
value={formData.type} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="name" className="block text-gray-700 font-medium mb-2"> | ||
Name | ||
</label> | ||
<input | ||
type="text" | ||
name="name" | ||
id="name" | ||
value={formData.name} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label | ||
htmlFor="species" | ||
className="block text-gray-700 font-medium mb-2" | ||
> | ||
Species | ||
</label> | ||
<input | ||
type="text" | ||
name="species" | ||
id="species" | ||
value={formData.species} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="breed" className="block text-gray-700 font-medium mb-2"> | ||
Breed | ||
</label> | ||
<input | ||
type="text" | ||
name="breed" | ||
id="breed" | ||
value={formData.breed} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="age" className="block text-gray-700 font-medium mb-2"> | ||
Age | ||
</label> | ||
<input | ||
type="number" | ||
name="age" | ||
id="age" | ||
value={formData.age} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label | ||
htmlFor="gender" | ||
className="block text-gray-700 font-medium mb-2" | ||
> | ||
Gender | ||
</label> | ||
<input | ||
type="text" | ||
name="gender" | ||
id="gender" | ||
value={formData.gender} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label htmlFor="size" className="block text-gray-700 font-medium mb-2"> | ||
Size | ||
</label> | ||
<input | ||
type="text" | ||
name="size" | ||
id="size" | ||
value={formData.size} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label | ||
htmlFor="description" | ||
className="block text-gray-700 font-medium mb-2" | ||
> | ||
Description | ||
</label> | ||
<textarea | ||
name="description" | ||
id="description" | ||
value={formData.description} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
/> | ||
</div> | ||
<div className="mb-4"> | ||
<label | ||
htmlFor="shelter" | ||
className="block text-gray-700 font-medium mb-2" | ||
> | ||
Shelter | ||
</label> | ||
<select | ||
name="shelter" | ||
id="shelter" | ||
value={formData.shelter.id} | ||
onChange={handleChange} | ||
className="w-full border border-gray-300 rounded p-2" | ||
> | ||
{shelters.map((shelter) => ( | ||
<option key={shelter.id} value={shelter.id}> | ||
{shelter.name} | ||
</option> | ||
))} | ||
</select> | ||
</div> | ||
<button | ||
type="submit" | ||
className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600" | ||
> | ||
Submit | ||
</button> | ||
</form> | ||
); | ||
} |
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,24 @@ | ||
export interface ShelterProp { | ||
url: string; | ||
name: string; | ||
address: string; | ||
city: string; | ||
state: string; | ||
zip_code: string; | ||
phone_number: string; | ||
id: number; | ||
} | ||
|
||
export interface PetCardProps { | ||
type: string; | ||
name: string; | ||
species: string; | ||
breed: string; | ||
age: number; | ||
gender: string; | ||
size: string; | ||
description: string; | ||
shelter: ShelterProp; | ||
image: string; | ||
id: number; | ||
} |
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