StillWorking commited on
Commit
cd95dc6
·
verified ·
1 Parent(s): 90fbeb3

Upload frontend/src/components/ui/breadcrumb.tsx with huggingface_hub

Browse files
frontend/src/components/ui/breadcrumb.tsx ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const Breadcrumb = React.forwardRef<
8
+ HTMLElement,
9
+ React.ComponentPropsWithoutRef<"nav"> & {
10
+ separator?: React.ReactNode;
11
+ }
12
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
13
+ Breadcrumb.displayName = "Breadcrumb";
14
+
15
+ const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<"ol">>(
16
+ ({ className, ...props }, ref) => (
17
+ <ol
18
+ ref={ref}
19
+ className={cn(
20
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
21
+ className,
22
+ )}
23
+ {...props}
24
+ />
25
+ ),
26
+ );
27
+ BreadcrumbList.displayName = "BreadcrumbList";
28
+
29
+ const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<"li">>(
30
+ ({ className, ...props }, ref) => (
31
+ <li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props} />
32
+ ),
33
+ );
34
+ BreadcrumbItem.displayName = "BreadcrumbItem";
35
+
36
+ const BreadcrumbLink = React.forwardRef<
37
+ HTMLAnchorElement,
38
+ React.ComponentPropsWithoutRef<"a"> & {
39
+ asChild?: boolean;
40
+ }
41
+ >(({ asChild, className, ...props }, ref) => {
42
+ const Comp = asChild ? Slot : "a";
43
+
44
+ return (
45
+ <Comp
46
+ ref={ref}
47
+ className={cn("transition-colors hover:text-foreground", className)}
48
+ {...props}
49
+ />
50
+ );
51
+ });
52
+ BreadcrumbLink.displayName = "BreadcrumbLink";
53
+
54
+ const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<"span">>(
55
+ ({ className, ...props }, ref) => (
56
+ <span
57
+ ref={ref}
58
+ role="link"
59
+ aria-disabled="true"
60
+ aria-current="page"
61
+ className={cn("font-normal text-foreground", className)}
62
+ {...props}
63
+ />
64
+ ),
65
+ );
66
+ BreadcrumbPage.displayName = "BreadcrumbPage";
67
+
68
+ const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<"li">) => (
69
+ <li
70
+ role="presentation"
71
+ aria-hidden="true"
72
+ className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
73
+ {...props}
74
+ >
75
+ {children ?? <ChevronRight />}
76
+ </li>
77
+ );
78
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
79
+
80
+ const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
81
+ <span
82
+ role="presentation"
83
+ aria-hidden="true"
84
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
85
+ {...props}
86
+ >
87
+ <MoreHorizontal className="h-4 w-4" />
88
+ <span className="sr-only">More</span>
89
+ </span>
90
+ );
91
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
92
+
93
+ export {
94
+ Breadcrumb,
95
+ BreadcrumbList,
96
+ BreadcrumbItem,
97
+ BreadcrumbLink,
98
+ BreadcrumbPage,
99
+ BreadcrumbSeparator,
100
+ BreadcrumbEllipsis,
101
+ };