feat: allow layout and _app overrides (#1611)

This commit is contained in:
Marvin Hagemeister
2023-08-09 16:35:53 +00:00
committed by GitHub
parent 81ae7b8427
commit 7ebaf0404d
13 changed files with 277 additions and 20 deletions
+19
View File
@@ -79,6 +79,18 @@ export interface RouteConfig {
* using the `useCSP` hook.
*/
csp?: boolean;
/**
* Mark this route as the root layout and ignore previously
* inherited layouts. Default: `false`
*/
rootLayout?: boolean;
/**
* Whether to use the `routes/_app` template if available or not.
* Default: `true`
*/
appTemplate?: boolean;
}
// deno-lint-ignore no-empty-interface
@@ -153,6 +165,8 @@ export interface Route<Data = any> {
component?: PageComponent<Data>;
handler: Handler<Data> | Handlers<Data>;
csp: boolean;
appLayout: boolean;
rootLayout: boolean;
}
export interface RouterState {
@@ -185,6 +199,7 @@ export type AsyncLayout<T = any, S = Record<string, unknown>> = (
export interface LayoutModule {
default: ComponentType<LayoutProps> | AsyncLayout;
config?: Pick<RouteConfig, "appTemplate" | "rootLayout">;
}
export interface LayoutRoute {
@@ -236,6 +251,8 @@ export interface UnknownPage {
component?: PageComponent<UnknownPageProps>;
handler: UnknownHandler;
csp: boolean;
appLayout: boolean;
rootLayout: boolean;
}
// --- ERROR PAGE ---
@@ -281,6 +298,8 @@ export interface ErrorPage {
component?: PageComponent<ErrorPageProps>;
handler: ErrorHandler;
csp: boolean;
appLayout: boolean;
rootLayout: boolean;
}
// --- MIDDLEWARES ---