Add Partials (#1824)

This commit is contained in:
Marvin Hagemeister
2023-09-27 13:34:30 +02:00
committed by GitHub
parent d9829e25e6
commit 665d35bbc2
92 changed files with 3271 additions and 116 deletions
@@ -0,0 +1,19 @@
import { Partial } from "$fresh/runtime.ts";
export default function SlotDemo() {
return (
<div>
<form fh-partial="/form/update">
<Partial name="slot-1">
<p class="status">Default content</p>
<p>
<input type="text" value="foo" />
</p>
</Partial>
<button type="submit" class="submit">
submit
</button>
</form>
</div>
);
}
@@ -0,0 +1,10 @@
import { defineRoute } from "$fresh/src/server/defines.ts";
export default defineRoute(() => {
return new Response("", {
status: 302,
headers: {
Location: "/form",
},
});
});
@@ -0,0 +1,19 @@
import { defineRoute } from "$fresh/src/server/defines.ts";
import { RouteConfig } from "$fresh/server.ts";
import { Partial } from "$fresh/runtime.ts";
export const config: RouteConfig = {
skipAppWrapper: true,
skipInheritedLayouts: true,
};
export default defineRoute((req, ctx) => {
return (
<Partial name="slot-1">
<p class="status-updated">it works</p>
<p>
<input type="text" />
</p>
</Partial>
);
});