Add Partials (#1824)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import { Fader } from "../../islands/Fader.tsx";
|
||||
import Stateful from "../../islands/Stateful.tsx";
|
||||
import { Keyed } from "../../components/Keyed.tsx";
|
||||
|
||||
export default function SlotDemo() {
|
||||
return (
|
||||
<div>
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p>Initial content</p>
|
||||
{[
|
||||
<Keyed key="A">
|
||||
<Stateful id="A" />
|
||||
</Keyed>,
|
||||
<Keyed key="B">
|
||||
<Stateful id="B" />
|
||||
</Keyed>,
|
||||
<Keyed key="C">
|
||||
<Stateful id="C" />
|
||||
</Keyed>,
|
||||
]}
|
||||
</Fader>
|
||||
</Partial>
|
||||
<p>
|
||||
<a
|
||||
class="swap-link"
|
||||
href="/keys_components/injected"
|
||||
fh-partial="/keys_components/swap"
|
||||
>
|
||||
swap
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
|
||||
export default defineRoute(() => {
|
||||
return new Response("", {
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: "/keys_components",
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
import { RouteConfig } from "$fresh/server.ts";
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import { Fader } from "../../islands/Fader.tsx";
|
||||
import Stateful from "../../islands/Stateful.tsx";
|
||||
import { Keyed } from "../../components/Keyed.tsx";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
skipAppWrapper: true,
|
||||
skipInheritedLayouts: true,
|
||||
};
|
||||
|
||||
export default defineRoute((req, ctx) => {
|
||||
return (
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-swap">swapped content</p>
|
||||
{[
|
||||
<Keyed key="C">
|
||||
<Stateful id="C" />
|
||||
</Keyed>,
|
||||
<Keyed key="B">
|
||||
<Stateful id="B" />
|
||||
</Keyed>,
|
||||
<Keyed key="A">
|
||||
<Stateful id="A" />
|
||||
</Keyed>,
|
||||
]}
|
||||
</Fader>
|
||||
</Partial>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user