"use client"; import type { ReactNode, FC } from "react"; import React, { useMemo } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { Breadcrumbs } from "@plane/ui"; import { usePlatformOS } from "@/hooks/use-platform-os"; type Props = { label?: string; href?: string; icon?: React.ReactNode; disableTooltip?: boolean; isLast?: boolean; }; const IconWrapper = React.memo(({ icon }: { icon: React.ReactNode }) => (
{icon}
)); IconWrapper.displayName = "IconWrapper"; const LabelWrapper = React.memo(({ label }: { label: ReactNode }) => (
{label}
)); LabelWrapper.displayName = "LabelWrapper"; const BreadcrumbContent = React.memo(({ icon, label }: { icon?: React.ReactNode; label?: ReactNode }) => { if (!icon && !label) return null; return ( <> {icon && } {label && } ); }); BreadcrumbContent.displayName = "BreadcrumbContent"; const ItemWrapper = React.memo(({ children, ...props }: React.ComponentProps) => ( {children} )); ItemWrapper.displayName = "ItemWrapper"; export const BreadcrumbLink: FC = observer((props) => { const { href, label, icon, disableTooltip = false, isLast = false } = props; const { isMobile } = usePlatformOS(); const itemWrapperProps = useMemo( () => ({ label: label?.toString(), disableTooltip: isMobile || disableTooltip, type: (href && href !== "" ? "link" : "text") as "link" | "text", isLast, }), [href, label, isMobile, disableTooltip, isLast] ); const content = useMemo(() => , [icon, label]); if (href) { return ( {content} ); } return {content}; }); BreadcrumbLink.displayName = "BreadcrumbLink";