diff --git a/packages/react/src/MainLayout.tsx b/packages/react/src/MainLayout.tsx index 3d32f0f..5875dbf 100644 --- a/packages/react/src/MainLayout.tsx +++ b/packages/react/src/MainLayout.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import { Link, Outlet, useLocation } from "react-router-dom"; import { Button } from "../components/Button"; +import RouteObject from "./RouteObject"; type Theme = "light" | "dark"; @@ -61,30 +62,18 @@ function TopNav() { PSW/UI - - Docs - - - Components - - - Github - + {RouteObject.mainNav.map((link) => { + return ( + + {link.name} + + ); + })}
diff --git a/packages/react/src/RouteObject.ts b/packages/react/src/RouteObject.ts new file mode 100644 index 0000000..4f2aa93 --- /dev/null +++ b/packages/react/src/RouteObject.ts @@ -0,0 +1,19 @@ +export default { + mainNav: [ + { + path: "/docs", + name: "Docs", + eq: (pathname: string) => pathname.startsWith("/docs") && !pathname.startsWith("/docs/components") + }, + { + path: "/docs/components", + name: "Components", + eq: (pathname: string) => pathname.startsWith("/docs/components") + }, + { + path: "https://github.com/p-sw/ui", + name: "Github", + eq: () => false + } + ] +} \ No newline at end of file