diff --git a/package.json b/package.json index ff0f1ee..188532b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "idea-creator", + "name": "thing-creator", "version": "0.1.0", "private": true, "dependencies": { @@ -27,7 +27,7 @@ "scripts": { "dev": "pnpm start", "start": "react-scripts start", - "build": "react-scripts build && cp -rf build dist && rm -rf build", + "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/src/components/Container.tsx b/src/components/Container.tsx index 530e660..52dd291 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -2,7 +2,7 @@ import { Box } from "@chakra-ui/react"; const Container: React.FC<{ children: React.ReactNode }> = ({ children }) => { return ( - + {children} ); diff --git a/src/components/CreatorForm.jsx b/src/components/CreatorForm.jsx new file mode 100644 index 0000000..5b85211 --- /dev/null +++ b/src/components/CreatorForm.jsx @@ -0,0 +1,66 @@ +import { + Button, + Flex, + Input, + Textarea +} from "@chakra-ui/react"; +import { useState } from "react"; +import createThing from "../services/createThing"; + +const CreatorForm = ({ setIsLoading, handleError, handleSuccess }) => { + // UPDATE STATE TO HANDLE YOUR TYPE + const [title, setTitle] = useState(""); + const [description, setDescription] = useState(""); + + // UPDATE HANDLE METHODS TO MATCH YOUR STATE + const handleTitleChange = (event) => { + setTitle(event.target.value); + }; + + const handleDescriptionChange = (event) => { + setDescription(event.target.value); + }; + + const handleSubmit = async () => { + setIsLoading(true); + // UPDATE OBJECT TO MATCH YOUR TYPE + const response = await createThing({ + title, + description, + }); + if (response.error) { + handleError(response.error); + } else { + handleSuccess(); + setTitle(""); + setDescription(""); + } + setIsLoading(false); + }; + + return ( + + {/* ADD YOUR INPUTS HERE */} + +