Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import { Link, useParams } from "react-router";
|
||||
import clsx from "clsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { adminPath } from "~/utils/app/CanonicalUrlUtils";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { HomeIcon } from "~/components/ui/icons/vendor";
|
||||
|
||||
interface MenuItem {
|
||||
title: string;
|
||||
routePath?: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
menu: MenuItem[];
|
||||
className?: string;
|
||||
home?: string;
|
||||
}
|
||||
|
||||
export default function Breadcrumb({ className = "", home = "", menu = [] }: Props) {
|
||||
const params = useParams();
|
||||
const { t } = useTranslation();
|
||||
function getHomeItem() {
|
||||
if (params.tenant) {
|
||||
return UrlUtils.currentTenantUrl(params, "dashboard");
|
||||
} else {
|
||||
return adminPath("dashboard", { mode: "host-aware" });
|
||||
}
|
||||
}
|
||||
return (
|
||||
<nav className={clsx(className, "border-border-default bg-surface-neutral-primary flex overflow-x-auto border-b")} aria-label={t("components.breadcrumb.ariaLabel")}>
|
||||
<ol className="flex w-full max-w-(--breakpoint-xl) space-x-4 px-4 sm:px-6 lg:px-8">
|
||||
<li className="flex">
|
||||
<div className="flex items-center">
|
||||
<Link to={home.length > 0 ? home : getHomeItem()} className="hover:text-text-neutral-tertiary text-text-neutral-tertiary">
|
||||
<HomeIcon className="h-5 w-5 shrink-0" aria-hidden="true" />
|
||||
<span className="sr-only">{t("shared.home")}</span>
|
||||
</Link>
|
||||
</div>
|
||||
</li>
|
||||
{menu.map((item, idx) => {
|
||||
return (
|
||||
<li key={idx} className="flex">
|
||||
<div className="flex items-center">
|
||||
<svg
|
||||
className="h-full w-5 shrink-0 text-gray-200 sm:w-6"
|
||||
viewBox="0 0 24 44"
|
||||
preserveAspectRatio="none"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path d="M.293 0l22 22-22 22h1.414l22-22-22-22H.293z" />
|
||||
</svg>
|
||||
|
||||
{/* Subframe Breadcrumbs typo: 14px/normal item text (font-[400] leading-[20px]) */}
|
||||
{(() => {
|
||||
if (!item.routePath) {
|
||||
return (
|
||||
<div className="text-text-neutral-tertiary hover:text-text-neutral-primary ml-2 select-none truncate text-sm font-normal leading-5 sm:ml-4">
|
||||
{item.title}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Link to={item.routePath} className="text-text-neutral-tertiary hover:text-text-neutral-primary ml-2 truncate text-sm font-normal leading-5 sm:ml-4">
|
||||
{item.title}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import clsx from "clsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
import RightIcon from "../icons/RightIcon";
|
||||
import { HomeIcon } from "~/components/ui/icons/vendor";
|
||||
|
||||
interface MenuItem {
|
||||
title: string;
|
||||
routePath?: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
menu: MenuItem[];
|
||||
className?: string;
|
||||
home?: string;
|
||||
}
|
||||
|
||||
export default function BreadcrumbSimple({ menu = [], className = "", home = "" }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<nav className={clsx("not-prose flex truncate", className)} aria-label={t("components.breadcrumb.ariaLabel")}>
|
||||
{/* Subframe Breadcrumbs layout: BreadcrumbsRoot "flex items-center gap-2" */}
|
||||
<ol className="flex items-center gap-2">
|
||||
{home && (
|
||||
<li>
|
||||
<div>
|
||||
<Link to={home.length > 0 ? home : "/"} className="hover:text-text-neutral-tertiary text-gray-300">
|
||||
<HomeIcon className="h-4 w-4 shrink-0" aria-hidden="true" />
|
||||
<span className="sr-only">{t("shared.home")}</span>
|
||||
</Link>
|
||||
</div>
|
||||
</li>
|
||||
)}
|
||||
{menu
|
||||
.filter((f) => f.title)
|
||||
.map((item, idx) => (
|
||||
<li key={item.title}>
|
||||
{/* Subframe Breadcrumbs layout: uniform gap-2, divider sized to 14px text */}
|
||||
<div className="flex items-center gap-2">
|
||||
{(idx > 0 || home) && <RightIcon className="text-text-neutral-tertiary h-3.5 w-3.5 shrink-0" />}
|
||||
{item.routePath ? (
|
||||
<Link
|
||||
to={item.routePath}
|
||||
className="hover:text-text-neutral-tertiary text-text-neutral-tertiary select-none text-sm leading-5 font-normal"
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="text-text-neutral-tertiary select-none text-sm leading-5 font-normal">{item.title}</span>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { useLocation } from "react-router";
|
||||
import { t as i18nT } from "i18next";
|
||||
import Breadcrumb from "./Breadcrumb";
|
||||
import BreadcrumbSimple from "./BreadcrumbSimple";
|
||||
|
||||
export default function PreviewBreadcrumbs() {
|
||||
const currentRoute = useLocation().pathname;
|
||||
return (
|
||||
<div id="breadcrumbs" className="not-prose w-full">
|
||||
<h3 className="text-sm font-medium">{i18nT("components.breadcrumb.preview.breadcrumb")}</h3>
|
||||
<div className="border-border flex items-center space-x-2 border border-dashed p-2">
|
||||
<Breadcrumb
|
||||
className="w-full"
|
||||
home="/"
|
||||
menu={[
|
||||
{ title: i18nT("components.breadcrumb.preview.docs"), routePath: "/docs" },
|
||||
{ title: i18nT("components.catalog.title"), routePath: "/docs/components" },
|
||||
{ title: i18nT("components.breadcrumb.preview.breadcrumbs"), routePath: currentRoute },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<h3 className="text-sm font-medium">{i18nT("components.breadcrumb.preview.simple")}</h3>
|
||||
<div className="border-border bg-background border border-dashed p-6">
|
||||
<BreadcrumbSimple
|
||||
className="not-prose w-full"
|
||||
home="/"
|
||||
menu={[
|
||||
{ title: i18nT("components.breadcrumb.preview.docs"), routePath: "/docs" },
|
||||
{ title: i18nT("components.catalog.title"), routePath: "/docs/components" },
|
||||
{ title: i18nT("components.breadcrumb.preview.breadcrumbs"), routePath: currentRoute },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user