Partials OK, auto navbar and content
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
export interface AppProperties {
|
||||
name: string;
|
||||
icon: string;
|
||||
pages: Record<string, string>;
|
||||
adminOnly: string[];
|
||||
}
|
||||
import { AppProperties } from "$root/defaults/interfaces.ts";
|
||||
|
||||
type AppNavigatorProps = {
|
||||
apps: Record<string, AppProperties>;
|
||||
|
||||
@@ -1,11 +1,29 @@
|
||||
import PartialLink from "$root/routes/(_components)/PartialLink.tsx";
|
||||
import { JSX } from "preact/jsx-runtime";
|
||||
|
||||
type NavbarProps = {
|
||||
currentApp: string;
|
||||
pages: Record<string, string>;
|
||||
};
|
||||
|
||||
export default function Navbar(props: NavbarProps) {
|
||||
const links: JSX.Element[] = [];
|
||||
|
||||
for (const page in props.pages) {
|
||||
links.push(
|
||||
<PartialLink
|
||||
link={`/${props.currentApp}${page === "index" ? "" : `/${page}`}`}
|
||||
partial={`/${props.currentApp}/partials${
|
||||
page === "index" ? "" : `/${page}`
|
||||
}`}
|
||||
display={props.pages[page]}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>{JSON.stringify(props.pages)}</p>
|
||||
</>
|
||||
<nav>
|
||||
{links}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user