diff --git a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx index 5fe752e6..d6ba2a4d 100644 --- a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx +++ b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx @@ -1,16 +1,18 @@ -import React from "react"; +import React, { useState } from "react"; import plus from "assets/icons/plus.svg"; import "./allTaskTableItem.scss"; const AllTaskTableItem = ({ task, projects }) => { - function toggleDescTask(e) { - e.target?.classList.toggle("open-desc-item"); - e.target - .closest("td") - ?.querySelector(".taskList__table__name-project") - .classList.toggle("hide-desc"); + const [desc, setDesc] = useState(false); + + function toggleDescTask() { + if (desc) { + setDesc(false); + } else { + setDesc(true); + } } return ( @@ -22,12 +24,17 @@ const AllTaskTableItem = ({ task, projects }) => { { - toggleDescTask(e); - }} + onClick={toggleDescTask} + className={desc ? "open-desc-item" : ""} /> -
{projects?.map((project) => {