feat: support route layouts via _layout.tsx (#1506)

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
Michael Gearhardt
2023-07-26 11:49:08 +02:00
committed by GitHub
co-authored by Marvin Hagemeister
parent 18857ea052
commit 1ed93cec88
27 changed files with 397 additions and 3 deletions
@@ -0,0 +1,5 @@
import { h } from "preact";
export default function JsLayout({ Component }) {
return h("div", { class: "js-layout" }, h(Component, null));
}
@@ -0,0 +1,5 @@
import { h } from "preact";
export default function JsPage() {
return h("div", { class: "js-page" }, "/files/js");
}
@@ -0,0 +1,9 @@
import { h } from "preact";
export default function JsxLayout({ Component }) {
return (
<div class="jsx-layout">
<Component />
</div>
);
}
@@ -0,0 +1,3 @@
export default function JsxPage() {
return <div class="jsx-page">/files/jsx page</div>;
}
@@ -0,0 +1,6 @@
import { h } from "preact";
import { LayoutProps } from "$fresh/server.ts";
export default function TsLayout({ Component }: LayoutProps) {
return h("div", { class: "ts-layout" }, h(Component, null));
}
@@ -0,0 +1,5 @@
import { h } from "preact";
export default function TsPage() {
return h("div", { class: "ts-page" }, "/files/ts");
}
@@ -0,0 +1,10 @@
import { h } from "preact";
import { LayoutProps } from "$fresh/server.ts";
export default function TsxLayout({ Component }: LayoutProps) {
return (
<div class="tsx-layout">
<Component />
</div>
);
}
@@ -0,0 +1,3 @@
export default function TsxPage() {
return <div class="tsx-page">/files/tsx page</div>;
}