From c6ca17650d1d322643353805ed571d23ffd3c29a Mon Sep 17 00:00:00 2001 From: bytesparallel Date: Thu, 10 Feb 2022 13:56:52 -0600 Subject: [PATCH] saving work on ch. 9 --- src/components/game/EventForm.js | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/components/game/EventForm.js diff --git a/src/components/game/EventForm.js b/src/components/game/EventForm.js new file mode 100644 index 0000000..b90a915 --- /dev/null +++ b/src/components/game/EventForm.js @@ -0,0 +1,67 @@ +import React, { useState, useEffect } from "react" +import { useHistory } from 'react-router-dom' +import { createEvent } from './EventManager' + + +export const EventForm = () => { + const history = useHistory() + const [eventTypes, setEventTypes] = useState([]) + + /* + Since the input fields are bound to the values of + the properties of this state variable, you need to + provide some default values. + */ + const [currentEvent, setCurrentEvent] = useState({ + skillLevel: 1, + Description: "", + date: "", + time: "", + game_id: 1, + organizer_id: 1 + }) + + useEffect(() => { + // TODO: Get the event types, then set the state + }, []) + + const changeEventState = (domEvent) => { + // TODO: Complete the onChange function + } + + return ( +
+

Register New Event

+
+
+ + +
+
+ + {/* TODO: create the rest of the input fields */} + + +
+ ) +} \ No newline at end of file