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
+17
View File
@@ -0,0 +1,17 @@
import { RouteConfig } from "$fresh/server.ts";
export const config: RouteConfig = {
appTemplate: false,
};
export default function OverridePage() {
return (
<html>
<body>
<p class="no-app">
no <pre>_app.tsx</pre> template
</p>
</body>
</html>
);
}
@@ -0,0 +1,13 @@
import { LayoutProps, RouteConfig } from "$fresh/server.ts";
export const config: RouteConfig = {
rootLayout: true,
};
export default function OverrideLayout({ Component }: LayoutProps) {
return (
<div class="override-layout">
<Component />
</div>
);
}
@@ -0,0 +1,7 @@
export default function OverridePage() {
return (
<div class="override-page">
/override index page
</div>
);
}
@@ -0,0 +1,13 @@
import { RouteConfig } from "$fresh/server.ts";
export const config: RouteConfig = {
appTemplate: false,
};
export default function OverridePage() {
return (
<p class="no-app">
no <code>_app.tsx</code> template
</p>
);
}
@@ -0,0 +1,13 @@
import { RouteConfig } from "$fresh/server.ts";
export const config: RouteConfig = {
rootLayout: true,
};
export default function OverridePage() {
return (
<p class="no-layouts">
no layouts
</p>
);
}
@@ -0,0 +1,14 @@
import { RouteConfig } from "$fresh/server.ts";
export const config: RouteConfig = {
appTemplate: false,
rootLayout: true,
};
export default function OverridePage() {
return (
<p class="no-app-no-layouts">
no <code>_app.tsx</code> template and no layouts
</p>
);
}