From 8d2358fbd9b193fbc4240e6cf970237641a3a473 Mon Sep 17 00:00:00 2001 From: Manik Maity Date: Thu, 7 Nov 2024 12:29:11 +0530 Subject: [PATCH] Added add poll form --- frontend/src/App.jsx | 2 + .../components/PollTableRow/PollTableRow.jsx | 2 +- frontend/src/pages/CreatePollForm.jsx | 67 +++++++++++++++++++ frontend/src/pages/Dashboard.jsx | 6 +- frontend/src/pages/Home.jsx | 2 +- 5 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 frontend/src/pages/CreatePollForm.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index d81d42a..2f7779e 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -8,6 +8,7 @@ import Register from "./pages/Register"; import Dashboard from "./pages/Dashboard"; import Bookmark from "./pages/Bookmark"; import VotingPage from "./pages/VotingPage"; +import CreatePollForm from "./pages/CreatePollForm"; function App() { return ( @@ -20,6 +21,7 @@ function App() { } /> } /> } /> + } /> ); diff --git a/frontend/src/components/PollTableRow/PollTableRow.jsx b/frontend/src/components/PollTableRow/PollTableRow.jsx index 560c2b6..fc82bc6 100644 --- a/frontend/src/components/PollTableRow/PollTableRow.jsx +++ b/frontend/src/components/PollTableRow/PollTableRow.jsx @@ -35,7 +35,7 @@ function PollTableRow({ poll, index }) { )} -
+
diff --git a/frontend/src/pages/CreatePollForm.jsx b/frontend/src/pages/CreatePollForm.jsx new file mode 100644 index 0000000..1370061 --- /dev/null +++ b/frontend/src/pages/CreatePollForm.jsx @@ -0,0 +1,67 @@ +// CreatePollForm.js +import React, { useState } from "react"; +import { FaPlus, FaTrashAlt } from "react-icons/fa"; + +function CreatePollForm() { + const [options, setOptions] = useState(["Option 1", "Option 2"]); + + return ( +
+
+

Create New Poll

+ + {/* Poll Title */} +
+ + +
+ + {/* Poll Description */} +
+ + +
+ + {/* Poll Options */} +
+ + {options.map((option, index) => ( +
+ + {options.length > 2 && ( + + )} +
+ ))} + +
+ + {/* Submit Button */} + +
+
+ ); +} + +export default CreatePollForm; diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index 83e7c86..0b54c80 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -21,7 +21,7 @@ function Dashboard() { )} {/* User Profile Sidebar */} -