diff --git a/client/src/components/derived/IngredientSelector.tsx b/client/src/components/derived/IngredientSelector.tsx index 77f3fa7..49f3131 100644 --- a/client/src/components/derived/IngredientSelector.tsx +++ b/client/src/components/derived/IngredientSelector.tsx @@ -16,19 +16,13 @@ function IngredientSelector({ position, ingredients, units, destroy }: Ingredien const [newOptions, setNewOptions] = useState(new Array()); const [selected, setSelected] = useState(new Array()); - useEffect(() => { - console.log(units); - }, []) - return ( - +
- - + - ( )} onKeyDown={(e) => { @@ -53,7 +47,6 @@ function IngredientSelector({ position, ingredients, units, destroy }: Ingredien /> - ( )} onKeyDown={(e) => { diff --git a/client/src/components/pages/AddRecipe.tsx b/client/src/components/pages/AddRecipe.tsx index 6e26aa7..07a2eaa 100644 --- a/client/src/components/pages/AddRecipe.tsx +++ b/client/src/components/pages/AddRecipe.tsx @@ -2,11 +2,14 @@ import { useAuthContext } from "../../context/AuthContext"; import { useCallback, useEffect, useState } from "react"; import { Button, Card, Divider, Page, Panel } from "../ui" import { DropdownData, IIngredient, IRecipe } from "../../schemas"; -import API from "../../util/API"; import { useSelectorContext } from "../../context/SelectorContext"; import IngredientSelector from "../derived/IngredientSelector"; -import { v4 } from "uuid"; import Protect from "../../util/Protect"; +import API from "../../util/API"; +import { v4 } from "uuid"; +import RichText from "../ui/RichText"; +import { TextareaAutosize, TextField } from "@mui/material"; +// import "/src/sass/pages/AddRecipe.scss"; const AddRecipe = () => { const { user, token } = useAuthContext(); @@ -45,7 +48,6 @@ const AddRecipe = () => { // once user information is available, store it in recipe data useEffect(() => { - if (!user) return; user && setInput((prev: IRecipe) => { return { ...prev, @@ -98,6 +100,10 @@ const AddRecipe = () => { setIngredientFields((prev) => [...prev, ]) setOptionCount(prev => prev + 1); } + + useEffect(() => { + console.log(input); + }, [input]) return ( @@ -107,12 +113,12 @@ const AddRecipe = () => {
- setInput({ ...input, name: e.target.value })} /> + setInput({ ...input, name: e.target.value })}/>
- setInput({ ...input, preptime: e.target.value })} /> + setInput({ ...input, preptime: e.target.value })}/>
@@ -121,20 +127,22 @@ const AddRecipe = () => {
{ data && ( + <> - -
+ +
{ ingredientFields } - +
+ )}
- - { "description here" } + + setInput({ ...input, description: text })} />
diff --git a/client/src/components/ui/Button.tsx b/client/src/components/ui/Button.tsx index d76e36d..071e260 100644 --- a/client/src/components/ui/Button.tsx +++ b/client/src/components/ui/Button.tsx @@ -1,7 +1,15 @@ import { ButtonComponent } from "../../util/types" import "/src/sass/components/Button.scss"; -const Button: ButtonComponent = ({ onClick = (() => {}), children, extraClasses, disabled = false, disabledText = null }) => { +const Button: ButtonComponent = ({ onClick = (() => {}), children, extraClasses, id = null, disabled = false, disabledText = null }) => { + if (id?.length) { + return ( + + ) + } + return (