Add Partials (#1824)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import { Fader } from "../../islands/Fader.tsx";
|
||||
import PropIsland from "../../islands/PropIsland.tsx";
|
||||
|
||||
export default function PropsDemo() {
|
||||
return (
|
||||
<div>
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-initial">initial</p>
|
||||
<PropIsland
|
||||
boolean={true}
|
||||
number={1}
|
||||
obj={{ foo: 123 }}
|
||||
strArr={["foo"]}
|
||||
string="foo"
|
||||
/>
|
||||
</Fader>
|
||||
</Partial>
|
||||
<p>
|
||||
<a
|
||||
class="update-link"
|
||||
href="/island_props/injected"
|
||||
fh-partial="/island_props/partial"
|
||||
>
|
||||
Update
|
||||
</a>
|
||||
</p>
|
||||
<pre id="logs" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineRoute } from "$fresh/src/server/defines.ts";
|
||||
|
||||
export default defineRoute(() => {
|
||||
return new Response("", {
|
||||
status: 302,
|
||||
headers: {
|
||||
Location: "/island_props",
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
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 PropIsland from "../../islands/PropIsland.tsx";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
skipAppWrapper: true,
|
||||
skipInheritedLayouts: true,
|
||||
};
|
||||
|
||||
export default defineRoute((req, ctx) => {
|
||||
return (
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-updated">updated</p>
|
||||
<PropIsland
|
||||
boolean={false}
|
||||
number={42}
|
||||
obj={{ foo: 123456 }}
|
||||
strArr={["foo", "bar"]}
|
||||
string="foobar"
|
||||
/>
|
||||
</Fader>
|
||||
</Partial>
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user