Skip to content

Commit

Permalink
fix: mark routes as const, remove unneeded params from link (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhu2000 authored Jan 21, 2023
1 parent aca334e commit e0a5c71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DocumentMagnifyingGlassIcon } from "@heroicons/react/24/outline";
import { Link } from "@tanstack/react-router";
import type { PropsWithChildren } from "react";
import { type PropsWithChildren } from "react";

import { NamespaceSelect } from "./namespaces/namespace-select";
import { serviceRoutes, todoRoutes, workloadsRoutes } from "./router";
Expand All @@ -24,20 +24,18 @@ export function Layout({ children }: PropsWithChildren) {
<div className="flex flex-1 flex-col overflow-y-auto">
<nav className="flex-1 space-y-1 px-2 py-4">
{sections.map(({ title, routes }) => (
<>
<span key={title}>
<h1 className="font-bold">{title}</h1>
{routes.map((item) => (
<Link
key={item.name}
to={item.path}
className="group flex items-center rounded-md p-2 text-sm font-medium text-gray-800 hover:bg-gray-400"
search={{}}
params={{}}
>
{item.name}
</Link>
))}
</>
</span>
))}
</nav>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export const workloadsRoutes = [
{ name: "Stateful Sets", path: "/stateful-sets", component: StatefulSets },
] as const;

export const serviceRoutes = [{ name: "Ingresses", path: "/ingresses", component: Ingresses }];
export const serviceRoutes = [
{ name: "Ingresses", path: "/ingresses", component: Ingresses },
] as const;

export const todoRoutes = [
{ name: "Testing", path: "/test-playground", component: TestPlayground },
];
] as const;

const routeConfig = rootRoute.addChildren([
rootRoute.createRoute({
Expand Down

0 comments on commit e0a5c71

Please sign in to comment.