Partials OK, auto navbar and content
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export interface AppProperties {
|
||||
name: string;
|
||||
icon: string;
|
||||
pages: Record<string, string>;
|
||||
adminOnly: string[];
|
||||
}
|
||||
|
||||
export type EmptyObject = Record<string | number | symbol, never>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import { EmptyObject } from "$root/defaults/interfaces.ts";
|
||||
|
||||
export default function makeIndex<
|
||||
IndexProps = EmptyObject,
|
||||
>(basePath: string) {
|
||||
return async function Index(props: IndexProps) {
|
||||
const index = (await import(`${basePath}/partials/index.tsx`)).Index;
|
||||
return index(props);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { JSX } from "preact";
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import { RouteConfig } from "$fresh/server.ts";
|
||||
|
||||
export function getConfig(): RouteConfig {
|
||||
return {
|
||||
skipAppWrapper: true,
|
||||
skipInheritedLayouts: true,
|
||||
};
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
export function makePartials<Props extends any>(
|
||||
page: (props: Props) => JSX.Element,
|
||||
) {
|
||||
return function WrappedElements(props: Props): JSX.Element {
|
||||
return (
|
||||
<Partial name="body">
|
||||
{page(props)}
|
||||
</Partial>
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user