diff --git a/client/src/components/CommunityCard/CommunityCard.jsx b/client/src/components/CommunityCard/CommunityCard.jsx index 8951979..891b6a1 100644 --- a/client/src/components/CommunityCard/CommunityCard.jsx +++ b/client/src/components/CommunityCard/CommunityCard.jsx @@ -1,9 +1,14 @@ +import { useNavigate } from "react-router-dom"; import Community from "../../assets/Community.svg"; export default function CommunityCard() { - return ( -
- -

Community

-
- ); + const navigate = useNavigate(); + return ( +
navigate("/community")} + > + +

Community

+
+ ); } diff --git a/client/src/components/community/NewCommunity.jsx b/client/src/components/community/NewCommunity.jsx new file mode 100644 index 0000000..21ad2ee --- /dev/null +++ b/client/src/components/community/NewCommunity.jsx @@ -0,0 +1,116 @@ +import { Modal } from "flowbite-react"; +import { useState } from "react"; +import PropTypes from "prop-types"; + +export default function NewCommunity({ showModal, setShowModal }) { + const [error, setError] = useState(""); + const [formData, setFormData] = useState({ + community_name: "", + privacy: "public", + about: "", + }); + + function handleChange(e) { + const { name, value } = e.target; + setFormData({ ...formData, [name]: value }); + } + + function handleSubmit() { + if (formData.community_name && formData.topic) { + setError(""); + } else if (!formData.community_name) { + setError("Please select a name"); + } else if (!formData.topic) { + setError("Please select a topic"); + } + } + return ( + <> + { + setError(""); + setShowModal(false); + }} + popup + > + +
New Community
+
+ + {error && ( + + {error} + + )} +
+ + +
+
+
+ + +
+
+
+ +