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
+18 -6
View File
@@ -23,9 +23,15 @@ import * as $17 from "./routes/foo/_layout.tsx";
import * as $18 from "./routes/foo/bar.tsx";
import * as $19 from "./routes/foo/index.tsx";
import * as $20 from "./routes/index.tsx";
import * as $21 from "./routes/other.tsx";
import * as $22 from "./routes/skip/sub/_layout.tsx";
import * as $23 from "./routes/skip/sub/index.tsx";
import * as $21 from "./routes/no_app.tsx";
import * as $22 from "./routes/other.tsx";
import * as $23 from "./routes/override/_layout.tsx";
import * as $24 from "./routes/override/index.tsx";
import * as $25 from "./routes/override/no_app.tsx";
import * as $26 from "./routes/override/no_layout.tsx";
import * as $27 from "./routes/override/no_layout_no_app.tsx";
import * as $28 from "./routes/skip/sub/_layout.tsx";
import * as $29 from "./routes/skip/sub/index.tsx";
const manifest = {
routes: {
@@ -50,9 +56,15 @@ const manifest = {
"./routes/foo/bar.tsx": $18,
"./routes/foo/index.tsx": $19,
"./routes/index.tsx": $20,
"./routes/other.tsx": $21,
"./routes/skip/sub/_layout.tsx": $22,
"./routes/skip/sub/index.tsx": $23,
"./routes/no_app.tsx": $21,
"./routes/other.tsx": $22,
"./routes/override/_layout.tsx": $23,
"./routes/override/index.tsx": $24,
"./routes/override/no_app.tsx": $25,
"./routes/override/no_layout.tsx": $26,
"./routes/override/no_layout_no_app.tsx": $27,
"./routes/skip/sub/_layout.tsx": $28,
"./routes/skip/sub/index.tsx": $29,
},
islands: {},
baseUrl: import.meta.url,
+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>
);
}