From a47bd40157bdca63aeb75446fce4e171c4387f7d Mon Sep 17 00:00:00 2001 From: Mohamed amaan <121436543+modamaan@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:21:55 +0530 Subject: [PATCH 01/11] FIXED: Implement Dropdown for Hidden Breadcrumb Paths Across the Platform (#9413) --- src/components/Common/Breadcrumbs.tsx | 146 +++++++++++++++----------- src/components/ui/breadcrumb.tsx | 118 +++++++++++++++++++++ 2 files changed, 201 insertions(+), 63 deletions(-) create mode 100644 src/components/ui/breadcrumb.tsx diff --git a/src/components/Common/Breadcrumbs.tsx b/src/components/Common/Breadcrumbs.tsx index c2c4aa57446..f55edd4ccf6 100644 --- a/src/components/Common/Breadcrumbs.tsx +++ b/src/components/Common/Breadcrumbs.tsx @@ -3,7 +3,19 @@ import { useState } from "react"; import CareIcon from "@/CAREUI/icons/CareIcon"; +import { + Breadcrumb, + BreadcrumbItem, + BreadcrumbList, + BreadcrumbSeparator, +} from "@/components/ui/breadcrumb"; import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; import useAppHistory from "@/hooks/useAppHistory"; @@ -69,76 +81,84 @@ export default function Breadcrumbs({ className={classNames("text-sm font-normal", crumb.style)} >
- - {isLastItem ? ( - {crumb.name} - ) : ( - - )} + + {isLastItem && {crumb.name}}
); }; return ( - + ); } diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx new file mode 100644 index 00000000000..de505bc5833 --- /dev/null +++ b/src/components/ui/breadcrumb.tsx @@ -0,0 +1,118 @@ +import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons"; +import { Slot } from "@radix-ui/react-slot"; +import * as React from "react"; + +import { cn } from "@/lib/utils"; + +const Breadcrumb = React.forwardRef< + HTMLElement, + React.ComponentPropsWithoutRef<"nav"> & { + separator?: React.ReactNode; + } +>(({ ...props }, ref) =>