From 3d99fa026f2c862d88e7e09abafcf9cff48a8fc0 Mon Sep 17 00:00:00 2001 From: Nafil Arzzam <92790024+Arzzam@users.noreply.github.com> Date: Mon, 1 Jan 2024 14:33:33 +0530 Subject: [PATCH] update icons for the scroll and update UI --- src/Components/Shifting/BoardView.tsx | 76 ++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/src/Components/Shifting/BoardView.tsx b/src/Components/Shifting/BoardView.tsx index 9c96daa0e59..c0d6c89f816 100644 --- a/src/Components/Shifting/BoardView.tsx +++ b/src/Components/Shifting/BoardView.tsx @@ -14,7 +14,7 @@ import { formatFilter } from "./Commons"; import { navigate } from "raviger"; import useConfig from "../../Common/hooks/useConfig"; import useFilters from "../../Common/hooks/useFilters"; -import { lazy, useState } from "react"; +import { lazy, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import withScrolling from "react-dnd-scrolling"; import ButtonV2 from "../Common/components/ButtonV2"; @@ -56,9 +56,32 @@ export default function BoardView() { const [boardFilter, setBoardFilter] = useState(activeBoards); const [isLoading] = useState(false); const { t } = useTranslation(); + const containerRef = useRef(null); + const [containerHeight, setContainerHeight] = useState(0); + + const handleScroll = (direction: "right" | "left") => { + const container = containerRef.current; + + if (container) { + const scrollAmount = 360; + const currentScrollLeft = container.scrollLeft; + + if (direction === "left") { + container.scrollTo({ + left: currentScrollLeft - scrollAmount, + behavior: "smooth", + }); + } else if (direction === "right") { + container.scrollTo({ + left: currentScrollLeft + scrollAmount, + behavior: "smooth", + }); + } + } + }; return ( -
+
- -
+ +
{isLoading ? ( ) : ( - boardFilter.map((board) => ( - - )) + <> +
+ handleScroll("left")} + /> +
+
+ {boardFilter.map((board) => ( + + ))} +
+
+ handleScroll("right")} + /> +
+ )}