From 13e74f1bde9f346af95ab31e6a9c3bcd5eae623a Mon Sep 17 00:00:00 2001 From: Kirill Chernakov Date: Mon, 28 Oct 2024 14:58:16 +0400 Subject: [PATCH] fix: hovering long dashboard names stretch NavBar --- keep-ui/components/navbar/DashboardLink.tsx | 51 ++++++++++++-------- keep-ui/components/navbar/DashboardLinks.tsx | 5 +- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/keep-ui/components/navbar/DashboardLink.tsx b/keep-ui/components/navbar/DashboardLink.tsx index cc046de60..80016e0bf 100644 --- a/keep-ui/components/navbar/DashboardLink.tsx +++ b/keep-ui/components/navbar/DashboardLink.tsx @@ -1,8 +1,8 @@ -import { useSortable } from '@dnd-kit/sortable'; +import { useSortable } from "@dnd-kit/sortable"; import { Subtitle } from "@tremor/react"; import { FiLayout } from "react-icons/fi"; import { LinkWithIcon } from "components/LinkWithIcon"; // Ensure you import this correctly -import classNames from 'classnames'; +import { clsx } from "clsx"; interface Dashboard { id: string; @@ -14,31 +14,40 @@ type DashboardLinkProps = { dashboard: Dashboard; pathname: string | null; deleteDashboard: (id: string) => void; + titleClassName?: string; }; -export const DashboardLink = ({ dashboard, pathname, deleteDashboard }: DashboardLinkProps) => { +export const DashboardLink = ({ + dashboard, + pathname, + deleteDashboard, + titleClassName, +}: DashboardLinkProps) => { const href = `/dashboard/${dashboard.dashboard_name}`; - const isActive = decodeURIComponent(pathname|| "") === href; - - const { isDragging } = - useSortable({ - id: dashboard.id, - }); + const isActive = decodeURIComponent(pathname || "") === href; + const { isDragging } = useSortable({ + id: dashboard.id, + }); return ( deleteDashboard(dashboard.id)} - > - - {dashboard.dashboard_name} - - + href={href} + icon={FiLayout} + isDeletable={true} + onDelete={() => deleteDashboard(dashboard.id)} + > + + {dashboard.dashboard_name} + + ); }; diff --git a/keep-ui/components/navbar/DashboardLinks.tsx b/keep-ui/components/navbar/DashboardLinks.tsx index cf0cab3d4..80fcc9c35 100644 --- a/keep-ui/components/navbar/DashboardLinks.tsx +++ b/keep-ui/components/navbar/DashboardLinks.tsx @@ -13,7 +13,7 @@ import { DashboardLink } from "./DashboardLink"; import { Subtitle, Button, Badge, Text } from "@tremor/react"; import { Disclosure } from "@headlessui/react"; import { IoChevronUp } from "react-icons/io5"; -import classNames from "classnames"; +import clsx from "clsx"; import { useDashboards } from "utils/hooks/useDashboards"; import { useApiUrl } from "utils/hooks/useConfig"; @@ -105,7 +105,7 @@ export const DashboardLinks = ({ session }: DashboardProps) => { Beta { dashboard={dashboard} pathname={pathname} deleteDashboard={deleteDashboard} + titleClassName="max-w-[150px] overflow-hidden overflow-ellipsis" /> )) ) : (