|
1 | 1 | import { useRouter } from "next/router"; |
2 | 2 | import { useEffect, useState } from "react"; |
| 3 | +import { RxCross2, RxPlus } from "react-icons/rx"; |
3 | 4 |
|
4 | 5 | import { TaskForm } from "@/components/task_form"; |
5 | 6 | import { TaskList } from "@/components/task_list"; |
@@ -34,6 +35,12 @@ export default function TasksPage() { |
34 | 35 | const [loading, setLoading] = useState<boolean>(true); |
35 | 36 | const [availableTopics, setAvailableTopics] = useState<Topic[]>([]); |
36 | 37 |
|
| 38 | + const [showAddTask, setShowAddTask] = useState(false); |
| 39 | + |
| 40 | + function toggleShowAddTask() { |
| 41 | + setShowAddTask(!showAddTask); |
| 42 | + } |
| 43 | + |
37 | 44 | useEffect(() => { |
38 | 45 | if (!id) return; |
39 | 46 |
|
@@ -144,15 +151,30 @@ export default function TasksPage() { |
144 | 151 | availableTopics={availableTopics} |
145 | 152 | /> |
146 | 153 | </div> |
147 | | - <div className="add-task-container sticky top-3 flex h-full flex-col items-center justify-start rounded-lg bg-slate-400 p-3 shadow-xl"> |
| 154 | + <div |
| 155 | + className="add-task-container sticky top-3 flex h-full flex-col items-center justify-start rounded-lg bg-slate-400 p-3 shadow-xl" |
| 156 | + style={{ display: showAddTask ? "flex" : "none" }} |
| 157 | + > |
148 | 158 | <h1 className="text-3xl font-bold text-slate-100">Add Task</h1> |
| 159 | + <button |
| 160 | + className="minimise-add-task-btn absolute right-3 top-3 h-7 w-7 text-lg hover:brightness-110" |
| 161 | + onClick={toggleShowAddTask} |
| 162 | + > |
| 163 | + <RxCross2 /> |
| 164 | + </button> |
149 | 165 | <div className="task-form-wrapper h-full overflow-auto"> |
150 | 166 | <TaskForm |
151 | 167 | userId={Number(id)} |
152 | 168 | onTaskCreated={handleTaskCreated} |
153 | 169 | /> |
154 | 170 | </div> |
155 | 171 | </div> |
| 172 | + <button |
| 173 | + className="toggle-add-task-button fixed bottom-9 right-9 flex h-12 w-12 items-center justify-center rounded-full border bg-slate-400 text-xl brightness-90 hover:brightness-110" |
| 174 | + onClick={toggleShowAddTask} |
| 175 | + > |
| 176 | + {!showAddTask ? <RxPlus /> : <RxCross2 />} |
| 177 | + </button> |
156 | 178 | </div> |
157 | 179 | </div> |
158 | 180 | </div> |
|
0 commit comments