Add Tournament form

This commit is contained in:
Owen Rees
2023-08-29 22:55:22 +02:00
parent 419a3dd0c0
commit d33d447f90
21 changed files with 924 additions and 110 deletions
+42
View File
@@ -0,0 +1,42 @@
import { TournamentFormProps } from "@/types";
import { useRef, useState } from "react";
import { LatLngLiteral } from "leaflet";
import { useAtomValue } from "jotai";
import { franceCenterAtom } from "@/app/atoms";
export const useTournamentForm = (): TournamentFormProps => {
const center = useAtomValue(franceCenterAtom);
const tournamentNameRef = useRef(null);
const dateRef = useRef(null);
const urlRef = useRef(null);
const timeControlRef = useRef(null);
const normRef = useRef(null);
const addressRef = useRef(null);
const townRef = useRef(null);
const departmentRef = useRef(null);
const countryRef = useRef(null);
const yourNameRef = useRef(null);
const yourEmailRef = useRef(null);
const messageRef = useRef(null);
const [position, setPosition] = useState<LatLngLiteral>(center);
return {
tournamentNameRef,
dateRef,
urlRef,
timeControlRef,
normRef,
addressRef,
townRef,
departmentRef,
countryRef,
yourNameRef,
yourEmailRef,
messageRef,
position,
setPosition,
};
};
export default useTournamentForm;