-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic date checking without api integration #9
- Loading branch information
Showing
4 changed files
with
189 additions
and
60 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
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,51 @@ | ||
import {useState} from "react"; | ||
import Calendar from "react-calendar"; | ||
import 'react-calendar/dist/Calendar.css'; | ||
import {value} from "firebase-tools/lib/deploymentTool"; | ||
|
||
const LISTING_NAME = "907 Westwood Blvd"; | ||
const LISTING_ID = 12; | ||
const AVAILABLE = [[new Date(2022, 11, 3,), new Date(2022,11,4)], | ||
[new Date(2022, 11, 6), new Date(2022, 2,31)]]; | ||
|
||
export function Listing() { | ||
|
||
const [name, setName] = useState(""); | ||
const [date, setDate] = useState(""); | ||
const [notes, setNotes] = useState(""); | ||
const [hasBooked, setHasBooked] = useState(false); | ||
console.log(date); | ||
if(!hasBooked) { | ||
return ( | ||
<div> | ||
<h1>{LISTING_NAME}</h1> | ||
<form onSubmit={() => setHasBooked(true)}> | ||
<label> | ||
<p>Your Name</p> | ||
<input name={"name"} onChange={(event) => setName(event.target.value)}/> | ||
</label> | ||
<label> | ||
<p>Date(PLACEHOLDER USE A CALENDAR LIBRARY)</p> | ||
<Calendar onChange={(value) => setDate(value)}/> | ||
</label> | ||
<label> | ||
<p>Any notes?</p> | ||
<input name={"notes"} onChange={(event) => setNotes(event.target.value)}/> | ||
</label> | ||
<label> | ||
<button type={"submit"}>Book!</button> | ||
</label> | ||
</form> | ||
</div> | ||
) | ||
} | ||
else{ | ||
return( | ||
<div> | ||
<h1>Thanks for booking {LISTING_NAME}!</h1> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Listing; |
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