Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

WorkspaceBreadcrumb.tsx

54 lines1.4 KB

1import type { ReactNode } from "react";
2​
3import { cn } from "../lib/utils";
4​
5interface WorkspaceBreadcrumbProps {
6 readonly ariaLabel: string;
7 readonly children: ReactNode;
8 readonly className?: string;
9}
10​
11export function WorkspaceBreadcrumb({ ariaLabel, children, className }: WorkspaceBreadcrumbProps) {
12 return (
13 <nav aria-label={ariaLabel} className={cn("min-w-0", className)}>
14 {/* Keep the flexible container draggable in Electron. Interactive
15 descendants are excluded by the shared .drag-region CSS rules. */}
16 <ol className="m-0 flex min-w-0 list-none items-center gap-2 p-0 text-sm sm:gap-3">
17 {children}
18 </ol>
19 </nav>
20 );
22​
23interface WorkspaceBreadcrumbItemProps {
24 readonly children: ReactNode;
25 readonly className?: string;
26 readonly current?: boolean;
28​
29export function WorkspaceBreadcrumbItem({
30 children,
31 className,
32 current = false,
33}: WorkspaceBreadcrumbItemProps) {
34 return (
35 <li
36 aria-current={current ? "page" : undefined}
37 className={cn(
38 "flex min-w-0 items-center font-medium",
39 current ? "text-foreground" : "shrink-0 text-muted-foreground",
40 className,
41 )}
42 >
43 {children}
44 </li>
45 );
47​
48export function WorkspaceBreadcrumbSeparator() {
49 return (
50 <li aria-hidden="true" className="flex shrink-0 items-center text-icon-muted">
51 /
52 </li>
53 );