diff --git a/client/src/components/Canvas/CanvasComponents/AddWidgetMenu.jsx b/client/src/components/Canvas/CanvasComponents/AddWidgetMenu.jsx index c2f4b5e..0413971 100644 --- a/client/src/components/Canvas/CanvasComponents/AddWidgetMenu.jsx +++ b/client/src/components/Canvas/CanvasComponents/AddWidgetMenu.jsx @@ -13,7 +13,7 @@ export default function AddWidgetMenu({appendWidget}) { appendWidget(AlertLevel, 3, 6, 3, 6, 3, 6)} // width and height are passed through here for each widget + onClick={() => appendWidget(AlertLevel, 4, 7, 4, 7, 4, 7)} // width and height are passed through here for each widget > Alert Level diff --git a/client/src/components/Canvas/CanvasComponents/AlertLevelWidget.jsx b/client/src/components/Canvas/CanvasComponents/AlertLevelWidget.jsx index c28945c..4f7fd2c 100644 --- a/client/src/components/Canvas/CanvasComponents/AlertLevelWidget.jsx +++ b/client/src/components/Canvas/CanvasComponents/AlertLevelWidget.jsx @@ -1,13 +1,18 @@ import Widget from "./Widget"; -import { Stack, Box, Field, Input, Button, Text } from "@chakra-ui/react"; +import { Stack, Box, Field, Input, Button, Text, Flex } from "@chakra-ui/react"; import { useForm } from "react-hook-form"; import { useState } from "react"; +import { LuAsterisk } from "react-icons/lu"; export default function AlertLevel({id, isEditable, isDelete, DeleteWidget}) { - const { register, handleSubmit } = useForm(); + const { register, handleSubmit, reset, formState: {errors} } = useForm(); const onSubmit = (data) => { - console.log(data); + console.log("data: ", data); + if (data.volcanoname === '') { + return null; + } setIsSubmit(true); + reset(); } const [isSubmit, setIsSubmit] = useState(false); @@ -16,6 +21,7 @@ export default function AlertLevel({id, isEditable, isDelete, DeleteWidget}) { return ( {!isSubmit ? ( + // DISPLAYING INPUT FIElDS AND LABELS - + - + Country Name + {/* place select drop down menu here instead of asking for input */} - - Volcano Name - - + + + + Volcano Name + + + + {errors.volcanoname && {errors.volcanoname.message}} + - + ):( + // DISPLAYING ALERT LEVEL DATA