From c8db6f237f8d97382b8965a02a0168cbc5e3eba3 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 18 Apr 2024 13:34:25 +0100 Subject: [PATCH] Refactor GanttChartRow component to improve readability and add padding to child rows --- .../src/Components/GanttChart/Row/Row.tsx | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/CommonUI/src/Components/GanttChart/Row/Row.tsx b/CommonUI/src/Components/GanttChart/Row/Row.tsx index cd1654241ee..619f3081ba8 100644 --- a/CommonUI/src/Components/GanttChart/Row/Row.tsx +++ b/CommonUI/src/Components/GanttChart/Row/Row.tsx @@ -35,37 +35,42 @@ const Row: FunctionComponent = ( level = 0; } - const hasChildRows = row.childRows.length > 0; + const hasChildRows: boolean = row.childRows.length > 0; - const shouldShowChildRows = level < 2; + const shouldShowChildRows: boolean = level < 2; const [showChildRows, setShowChildRows] = useState(shouldShowChildRows); + const paddingCount: number = level * 4; + return ( // rectangle div with curved corners and text inside in tailwindcss
-
-
- {hasChildRows && ( - { - return setShowChildRows(!showChildRows); - }} - /> - )} +
+
+
+ {hasChildRows && ( + { + return setShowChildRows(!showChildRows); + }} + /> + )} +
+
-
{row.bars.map((bar: GanttChartBar, i: number) => { @@ -110,7 +115,7 @@ const Row: FunctionComponent = (
{showChildRows && ( -
+
{row.childRows.map((childRow: GanttChartRow, i: number) => { return (