aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/components/Navigation.tsx
diff options
context:
space:
mode:
authorHsiangNianian <admin@jyunko.cn>2023-04-22 19:52:26 +0800
committerHsiangNianian <admin@jyunko.cn>2023-04-22 19:52:26 +0800
commit4838df315931bb883f704ec3e1abe2685f296cdf (patch)
tree57a8550c4cd5338f1126364bb518c6cde8d96e7d /docs/components/Navigation.tsx
parentdb74ade0234a40c2120ad5f2a41bee50ce13de02 (diff)
downloadHydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.tar.gz
HydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.zip
😀
Diffstat (limited to 'docs/components/Navigation.tsx')
-rw-r--r--docs/components/Navigation.tsx47
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/components/Navigation.tsx b/docs/components/Navigation.tsx
new file mode 100644
index 0000000..d72b714
--- /dev/null
+++ b/docs/components/Navigation.tsx
@@ -0,0 +1,47 @@
+import { Navbar } from "nextra-theme-docs";
+import { useTurboSite } from "./SiteSwitcher";
+
+function Navigation(props) {
+ const site = useTurboSite();
+
+ /*
+ Inject a dynamic docs link when NOT on root
+ 1. Points to /repo/docs when on /repo
+ 2. Points to /pack/docs when on /pack
+ */
+ const leadingItem = props.items[0];
+ if (leadingItem?.id !== "contextual-docs" && site) {
+ props.items.unshift({
+ title: "Docs",
+ type: "page",
+ route: `/${site}/docs`,
+ id: "contextual-docs",
+ key: "contextual-docs",
+ });
+ }
+
+ const lastItem = props.items[props.items.length - 1];
+ if (lastItem?.id !== "contextual-enterprise") {
+ props.items.push({
+ title: "Enterprise",
+ newWindow: true,
+ // https://github.com/shuding/nextra/issues/1028
+ route: "enterprise",
+ href: `https://vercel.com/${
+ site === "repo" ? "solutions/turborepo" : "contact/sales"
+ }?utm_source=turbo.build&utm_medium=referral&utm_campaign=header-enterpriseLink`,
+ id: "contextual-enterprise",
+ key: "contextual-enterprise",
+ });
+ }
+
+ // remove the top level repo and pack links
+ const headerItems = props.items.filter((item) => {
+ return item.name !== "repo" && item.name !== "pack";
+ });
+
+ // items last to override the default
+ return <Navbar {...props} items={headerItems} />;
+}
+
+export default Navigation;