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,37 @@
|
||||
import { useLocation } from "react-router";
|
||||
import clsx from "clsx";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function HeadingWithTabs({ tabs }: { tabs: { name: string; href: string }[] }) {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
function isCurrent(idx: number) {
|
||||
return currentTab() === tabs[idx];
|
||||
}
|
||||
const currentTab = () => {
|
||||
return tabs.find((element) => element.href && UrlUtils.stripTrailingSlash(location.pathname) === UrlUtils.stripTrailingSlash(element.href));
|
||||
};
|
||||
return (
|
||||
<div className="w-full sm:flex sm:items-baseline">
|
||||
<h3 className="text-text-neutral-primary text-lg font-medium leading-6">{t("components.tabs.headingWithTabs.issues")}</h3>
|
||||
<div className="mt-4 sm:ml-10 sm:mt-0">
|
||||
<nav className="-mb-px flex space-x-8">
|
||||
{tabs.map((tab, idx) => (
|
||||
<a
|
||||
key={tab.name}
|
||||
href={tab.href}
|
||||
className={clsx(
|
||||
isCurrent(idx) ? "border-theme-500 text-theme-600" : "hover:border-border-default text-text-neutral-tertiary hover:text-text-neutral-primary/80 border-transparent",
|
||||
"whitespace-nowrap border-b-2 px-1 pb-4 text-sm font-medium"
|
||||
)}
|
||||
aria-current={isCurrent(idx) ? "page" : undefined}
|
||||
>
|
||||
{tab.name}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user