Partials OK, auto navbar and content

This commit is contained in:
Kevin FEDYNA
2025-01-15 15:43:52 +01:00
parent ed2997d51f
commit 9db588ff02
24 changed files with 510 additions and 321 deletions
+7 -6
View File
@@ -1,24 +1,25 @@
import { FreshContext } from "$fresh/server.ts";
import { Partial } from "$fresh/runtime.ts";
import { State } from "$root/routes/_middleware.ts";
import { AppProperties } from "$root/defaults/interfaces.ts";
import Navbar from "$root/routes/(_islands)/Navbar.tsx";
import { AppProperties } from "$root/routes/(_islands)/AppNavigator.tsx";
export default async function AppLayout(
request: Request,
context: FreshContext<State>,
) {
const currentApp = new URL(request.url).pathname;
const pathname = new URL(request.url).pathname;
const currentApp = pathname.split("/")[1];
const properties: AppProperties = (await import(
`./${currentApp}/(_props)/props.ts`
)).default;
)).default;
return (
<>
<Navbar pages={properties.pages} />
<section id="app">
<Navbar currentApp={currentApp} pages={properties.pages} />
<Partial name="body">
<context.Component />
</Partial>
</>
</section>
);
}