-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
95 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { useSignal } from "@preact/signals"; | ||
|
||
interface Props { | ||
name: string; | ||
name: string; | ||
} | ||
|
||
export default function NextContentButton({ name }: Props) { | ||
const id = useSignal(0); | ||
const id = useSignal(0); | ||
|
||
return ( | ||
<a | ||
class="px-2 py-1 border-gray-500 border-2 rounded bg-white hover:bg-gray-200 transition-colors" | ||
href="/about" | ||
f-partial={`/partials/about/${id}`} | ||
onClick={() => (id.value += 1)} | ||
> | ||
{name} | ||
</a> | ||
); | ||
return ( | ||
<a | ||
class="px-2 py-1 border-gray-500 border-2 rounded bg-white hover:bg-gray-200 transition-colors" | ||
href="/about" | ||
f-partial={`/partials/about/${id}`} | ||
onClick={() => (id.value += 1)} | ||
> | ||
{name} | ||
</a> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { PageProps } from "$fresh/server.ts"; | ||
|
||
export default function Error500Page({ error }: PageProps) { | ||
return <p>500 internal error: {(error as Error).message}</p>; | ||
return <p>500 internal error: {(error as Error).message}</p>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { PageProps } from "$fresh/server.ts"; | ||
|
||
export default function Layout({ Component, state }: PageProps) { | ||
// do something with state here | ||
return ( | ||
<div class="px-4 py-8 mx-auto bg-cyan-300 h-screen"> | ||
<Component /> | ||
</div> | ||
); | ||
// do something with state here | ||
return ( | ||
<div class="px-4 py-8 mx-auto bg-cyan-300 h-screen"> | ||
<Component /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { FreshContext } from "$fresh/server.ts"; | ||
|
||
interface State { | ||
data: string; | ||
data: string; | ||
} | ||
|
||
export async function handler( | ||
_req: Request, | ||
ctx: FreshContext<State>, | ||
_req: Request, | ||
ctx: FreshContext<State>, | ||
) { | ||
ctx.state.data = "myData"; | ||
const resp = await ctx.next(); | ||
resp.headers.set("server", "fresh server"); | ||
return resp; | ||
ctx.state.data = "myData"; | ||
const resp = await ctx.next(); | ||
resp.headers.set("server", "fresh server"); | ||
return resp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Handlers } from "$fresh/server.ts"; | ||
|
||
export const handler: Handlers = { | ||
GET(_req) { | ||
const uuid = crypto.randomUUID(); | ||
return new Response(JSON.stringify(uuid), { | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
}, | ||
GET(_req) { | ||
const uuid = crypto.randomUUID(); | ||
return new Response(JSON.stringify(uuid), { | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { FreshContext } from "$fresh/server.ts"; | ||
|
||
export async function handler(_req: Request, ctx: FreshContext) { | ||
const currentName = ctx.params.name; | ||
if (currentName === "Bob") { | ||
ctx.params.name = "super-bob"; | ||
} | ||
const resp = await ctx.next(); | ||
return resp; | ||
const currentName = ctx.params.name; | ||
if (currentName === "Bob") { | ||
ctx.params.name = "super-bob"; | ||
} | ||
const resp = await ctx.next(); | ||
return resp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters