From d55125ec330bd32c544f13ac599ff2a770977d3c Mon Sep 17 00:00:00 2001 From: Yaman Date: Tue, 9 Dec 2025 11:59:50 -0600 Subject: [PATCH 1/2] adding blah --- .../components/LinearProgressBar/index.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 task-list/src/components/LinearProgressBar/index.tsx diff --git a/task-list/src/components/LinearProgressBar/index.tsx b/task-list/src/components/LinearProgressBar/index.tsx new file mode 100644 index 0000000..966c4d8 --- /dev/null +++ b/task-list/src/components/LinearProgressBar/index.tsx @@ -0,0 +1,20 @@ +import { FC } from "react" +import "./style.scss" + +interface Props { + percentage: number + blah?: string +} + +const LinearProgressBar: FC = ({ percentage }) => { + return ( +
+
+
+
+ {percentage}% +
+ ) +} + +export default LinearProgressBar From 0bee1a02f13070af925bb407bfb185cfefb69f79 Mon Sep 17 00:00:00 2001 From: Yaman Date: Tue, 9 Dec 2025 12:05:49 -0600 Subject: [PATCH 2/2] adding 'Add' task feature --- task-list/src/App.tsx | 35 +++++++++++--- .../src/components/AddEditTaskForm/index.tsx | 47 +++++++++++++++---- .../components/LinearProgressBar/index.tsx | 1 - .../components/LinearProgressBar/style.scss | 33 +++++++++++++ task-list/src/components/TaskCard/index.tsx | 6 +-- task-list/src/components/TaskCard/style.scss | 2 + 6 files changed, 106 insertions(+), 18 deletions(-) create mode 100644 task-list/src/components/LinearProgressBar/style.scss diff --git a/task-list/src/App.tsx b/task-list/src/App.tsx index e02a4d6..96367a5 100644 --- a/task-list/src/App.tsx +++ b/task-list/src/App.tsx @@ -1,28 +1,51 @@ +import { useState } from "react" import "./App.scss" import { ReactComponent as Add } from "./assets/icons/add.svg" import AddEditTaskForm from "./components/AddEditTaskForm" import Button from "./components/Button" import DeleteModal from "./components/DeleteModal" import TaskCard from "./components/TaskCard" -import { taskList } from "./siteData/taskList" +import { taskList as initialTaskList } from "./siteData/taskList" + +type Task = { + id: string + title: string + priority: "high" | "medium" | "low" + status: string + progress: number +} const App = () => { - const showAddEditModal = false + const [tasks, setTasks] = useState(initialTaskList as Task[]) + const [showAddEditModal, setShowAddEditModal] = useState(false) const showDeleteModal = false + + const handleAddTask = (title: string, priority: "high" | "medium" | "low") => { + const newTask: Task = { + id: Date.now().toString(), + title, + priority, + status: "To Do", + progress: 0, + } + setTasks([newTask, ...tasks]) // Add new task at the beginning + setShowAddEditModal(false) + } + return (

Task List

-
- {taskList.map((task) => ( - + {tasks.map((task) => ( + ))}
- {showAddEditModal && } + {showAddEditModal && setShowAddEditModal(false)} onSave={handleAddTask} />} {showDeleteModal && }
) diff --git a/task-list/src/components/AddEditTaskForm/index.tsx b/task-list/src/components/AddEditTaskForm/index.tsx index c1171d4..0d22ead 100644 --- a/task-list/src/components/AddEditTaskForm/index.tsx +++ b/task-list/src/components/AddEditTaskForm/index.tsx @@ -1,32 +1,63 @@ import classNames from "classnames" +import { useState } from "react" import { ReactComponent as Close } from "../../assets/icons/close.svg" import Button from "../Button" import Input from "../Input" import Modal from "../Modal" import "./style.scss" -const AddEditTaskForm = () => { +type AddEditTaskFormProps = { + onClose: () => void + onSave: (title: string, priority: "high" | "medium" | "low") => void +} + +const AddEditTaskForm = ({ onClose, onSave }: AddEditTaskFormProps) => { + const [title, setTitle] = useState("") + const [priority, setPriority] = useState<"high" | "medium" | "low">("medium") + + // Check if title is valid (not empty and not just whitespace) + const isValidTitle = title.trim().length > 0 + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault() + if (isValidTitle) { + onSave(title.trim(), priority) + } + } + return ( -
+
Add Task - +
- {}} name="title" value="" /> + setTitle(e.target.value)} + name="title" + value={title} + />
Priority
    - {["high", "medium", "low"].map((priority) => ( -
  • - {priority} + {(["high", "medium", "low"] as const).map((priorityOption) => ( +
  • setPriority(priorityOption)} + > + {priorityOption}
  • ))}
-
diff --git a/task-list/src/components/LinearProgressBar/index.tsx b/task-list/src/components/LinearProgressBar/index.tsx index 966c4d8..699904a 100644 --- a/task-list/src/components/LinearProgressBar/index.tsx +++ b/task-list/src/components/LinearProgressBar/index.tsx @@ -3,7 +3,6 @@ import "./style.scss" interface Props { percentage: number - blah?: string } const LinearProgressBar: FC = ({ percentage }) => { diff --git a/task-list/src/components/LinearProgressBar/style.scss b/task-list/src/components/LinearProgressBar/style.scss new file mode 100644 index 0000000..e6498d8 --- /dev/null +++ b/task-list/src/components/LinearProgressBar/style.scss @@ -0,0 +1,33 @@ +@use "../../styles/index.scss" as *; + +.linear-progress-container { + display: flex; + align-items: center; + gap: 10px; + min-width: 120px; +} + +.linear-progress-bar { + flex: 1; + height: 8px; + background-color: #e5e6e9; + border-radius: 10px; + overflow: hidden; + position: relative; +} + +.linear-progress-fill { + height: 100%; + background-color: #713fff; + border-radius: 10px; + transition: width 0.3s ease; +} + +.linear-progress-text { + font-size: 12px; + font-weight: 600; + color: $primary-color; + min-width: 35px; + text-align: right; +} + diff --git a/task-list/src/components/TaskCard/index.tsx b/task-list/src/components/TaskCard/index.tsx index f5fc868..206aaa7 100644 --- a/task-list/src/components/TaskCard/index.tsx +++ b/task-list/src/components/TaskCard/index.tsx @@ -1,11 +1,11 @@ import classNames from "classnames" import { ReactComponent as DeleteIcon } from "../../assets/icons/delete.svg" import { ReactComponent as EditIcon } from "../../assets/icons/edit.svg" -import CircularProgressBar from "../CircularProgressBar" +import LinearProgressBar from "../LinearProgressBar" import "./style.scss" const TaskCard = ({ task }: any) => { - const { id, title, priority, status, progress } = task + const { title, priority, status, progress } = task return (
@@ -21,7 +21,7 @@ const TaskCard = ({ task }: any) => {
- +
diff --git a/task-list/src/components/TaskCard/style.scss b/task-list/src/components/TaskCard/style.scss index 92edc04..8b21597 100644 --- a/task-list/src/components/TaskCard/style.scss +++ b/task-list/src/components/TaskCard/style.scss @@ -78,8 +78,10 @@ } .progress { + min-width: 150px; @include breakpoints.devices(sm) { margin-top: 15px; + width: 100%; } }