mirror of
https://github.com/UofCBaja/BajaUofCWebsite.git
synced 2025-06-15 21:34:17 -06:00
feat(TimeSlotSelector): Mapped out time slot buttons.
This commit is contained in:
parent
6cbd1cc4f5
commit
583be5dcd2
@ -36,7 +36,7 @@ const TimeSlotSelector = ({ onTimeSlotSelect }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleTimeSlotChange = (e) => {
|
const handleTimeSlotChange = (e) => {
|
||||||
let startTime = e.target.value;
|
let startTime = e.target.innerHTML;
|
||||||
onTimeSlotSelect((prev) => ({ ...prev, startTime }));
|
onTimeSlotSelect((prev) => ({ ...prev, startTime }));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,17 +53,30 @@ const TimeSlotSelector = ({ onTimeSlotSelect }) => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h4>Available Time Slots for {selectedDate}:</h4>
|
<h4>Available Time Slots for {selectedDate}:</h4>
|
||||||
{timeSlots.length > 0 ? (
|
{selectedDate === undefined ? (
|
||||||
<select onChange={handleTimeSlotChange}>
|
<>
|
||||||
<option value="">Select a time slot</option>
|
<p>Please select a date.</p>
|
||||||
{timeSlots.map((time, index) => (
|
</>
|
||||||
<option key={index} value={time}>
|
) : timeSlots.length > 0 ? (
|
||||||
{time}
|
<>
|
||||||
</option>
|
{Object.values(timeSlots).map((time) => {
|
||||||
))}
|
return (
|
||||||
</select>
|
<button
|
||||||
|
key={time}
|
||||||
|
onClick={(self) => {
|
||||||
|
console.log(self.target.innerHTML);
|
||||||
|
handleTimeSlotChange(self);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{time}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<p>No available time slots for the selected date.</p>
|
<>
|
||||||
|
<p>No available time slots for the selected date.</p>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user