rearch links, routes + add resume link

This commit is contained in:
2026-03-07 12:17:21 -06:00
parent 23d206de99
commit 1a5b5a336f
7 changed files with 104 additions and 49 deletions

View File

@@ -1,10 +1,31 @@
import {PropsWithChildren} from "react";
import React, {PropsWithChildren} from "react";
import {useRouter} from "./RouterContext";
import {Path} from "./router";
export function Route(props: PropsWithChildren & {path: Path}) {
const Canvas = React.lazy(() => import("../index/Canvas"));
const About = React.lazy(() => import("../about/AboutPage"));
export const ROUTES: [Path, string][] = [
["/", "Home"],
["/about", "About"],
["/articles", "Articles"]
];
function Route(props: PropsWithChildren & {path: Path}) {
const {path, children} = props;
const router = useRouter();
return router.current.toLowerCase() === path ? <>{children}</> : <></>
return <>{router.current === path && children}</>
}
export function Routes() {
return <>
<Route path={ROUTES[0]![0]}>
<Canvas/>
</Route>
<Route path={ROUTES[1]![0]}>
<About/>
</Route>
</>
}