Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/ui/components/Breadcrumbs/Breadcrumbs.tsx
T

87 lines
2.2 KiB
TypeScript

"use client";
/*
* Documentation:
* Breadcrumbs — https://app.subframe.com/f023064a5ca0/library?component=Breadcrumbs_8898334b-a66f-4ee8-8bd1-afcfa8e37cc0
*/
import React from "react";
import { FeatherChevronRight } from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface ItemProps extends React.HTMLAttributes<HTMLSpanElement> {
children?: React.ReactNode;
active?: boolean;
className?: string;
}
const Item = React.forwardRef<HTMLSpanElement, ItemProps>(function Item(
{ children, active = false, className, ...otherProps }: ItemProps,
ref
) {
return children ? (
<span
className={SubframeUtils.twClassNames(
"group/bbdc1640 line-clamp-1 cursor-pointer break-words text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary hover:text-text-neutral-primary",
{ "text-text-neutral-primary": active },
className
)}
ref={ref}
{...otherProps}
>
{children}
</span>
) : null;
});
export interface DividerProps
extends React.ComponentProps<typeof FeatherChevronRight> {
className?: string;
}
const Divider = React.forwardRef<
React.ElementRef<typeof FeatherChevronRight>,
DividerProps
>(function Divider({ className, ...otherProps }: DividerProps, ref) {
return (
<FeatherChevronRight
className={SubframeUtils.twClassNames(
"text-body-small-regular-0 font-body-small-regular-0 text-icon-neutral-tertiary",
className
)}
ref={ref}
{...otherProps}
/>
);
});
export interface BreadcrumbsRootProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
className?: string;
}
const BreadcrumbsRoot = React.forwardRef<HTMLDivElement, BreadcrumbsRootProps>(
function BreadcrumbsRoot(
{ children, className, ...otherProps }: BreadcrumbsRootProps,
ref
) {
return children ? (
<div
className={SubframeUtils.twClassNames(
"flex items-center gap-2",
className
)}
ref={ref}
{...otherProps}
>
{children}
</div>
) : null;
}
);
export const Breadcrumbs = Object.assign(BreadcrumbsRoot, {
Item,
Divider,
});