Skip to content

Commit cb6d02d

Browse files
feat: refresh landing page for Fresh 2.3 (#3775)
- Update HelloBar to announce Fresh 2.3 with feature callouts (WebSockets, View Transitions, Temporal API) - Rework hero section: new headline ("The framework so simple, you already know it"), descriptive subtitle, moved CTA to left - Remove old Simple section, add "Take a tour of Fresh" heading before showcase - Add new showcase sections: View Transitions, API Routes/Handlers, WebSockets, `<Head>` element, OpenTelemetry - Fix broken Deco showcase image (missing `/showcase/` directory) - Fix syntax highlighting in Simple section (was using raw `<pre>` instead of Prism) - Update RenderingSection to use Temporal API instead of Date API - Fix cursor styles on Forms and Partials interactive demos - Move WebSocket docs from Examples to Advanced in TOC - Densify all showcase sections: smaller headings, code blocks, icons, demo boxes, arrows, and tighter spacing --------- Co-authored-by: Josh Collinsworth <joshuajcollinsworth@gmail.com>
1 parent d16172e commit cb6d02d

28 files changed

Lines changed: 953 additions & 132 deletions
File renamed without changes.

docs/latest/examples/common-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const handler = define.handlers({
176176
## WebSockets
177177

178178
Fresh provides first-class WebSocket support via `ctx.upgrade()`. See the full
179-
[WebSocket guide](/docs/examples/websockets) for all options.
179+
[WebSocket guide](/docs/advanced/websockets) for all options.
180180

181181
## Subdomain routing
182182

docs/latest/examples/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ that you may like in your Fresh project.
1313
- [Sharing state between islands](./examples/sharing-state-between-islands)
1414
- [Active links](./examples/active-links)
1515
- [Session management](./examples/session-management)
16-
- [WebSockets](./examples/websockets)
1716
- [Common Patterns](./examples/common-patterns)

docs/toc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const toc: RawTableOfContents = {
6161
["environment-variables", "Environment Variables", "link:latest"],
6262
["head", "<head> element", "link:latest"],
6363
["vite", "Vite Plugin Options", "link:latest"],
64+
["websockets", "WebSockets", "link:latest"],
6465
["opentelemetry", "OpenTelemetry", "link:latest"],
6566
["api-reference", "API Reference", "link:latest"],
6667
["troubleshooting", "Troubleshooting", "link:latest"],
@@ -107,7 +108,6 @@ const toc: RawTableOfContents = {
107108
],
108109
["active-links", "Active links", "link:latest"],
109110
["session-management", "Session management", "link:latest"],
110-
["websockets", "WebSockets", "link:latest"],
111111
["common-patterns", "Common Patterns", "link:latest"],
112112
],
113113
},

www/components/CodeBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function CodeBlock(
55
) {
66
return (
77
<pre
8-
class="rounded-lg text-base leading-relaxed bg-slate-800 text-white p-4 sm:p-6 md:p-4 lg:p-6 2xl:p-8 overflow-x-auto"
8+
class="rounded-lg text-sm leading-relaxed bg-slate-800 text-white p-3 sm:p-4 overflow-x-auto"
99
data-language={lang}
1010
// deno-lint-ignore react-no-danger
1111
><code dangerouslySetInnerHTML={{ __html: Prism.highlight(code, Prism.languages[lang], lang)}} /></pre>

www/components/CodeWindow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function CodeWindow(props: CodeWindowProps) {
1414
style={props.style}
1515
>
1616
<div class="flex items-stretch justify-start">
17-
<div class="p-4 flex items-center">
17+
<div class="p-3 flex items-center">
1818
<svg
1919
aria-hidden="true"
2020
width="41"
@@ -28,7 +28,7 @@ export function CodeWindow(props: CodeWindowProps) {
2828
<ellipse cx="35.9134" cy="5" rx="4.99155" ry="5" fill="#26C940" />
2929
</svg>
3030
</div>
31-
<div class="p-4 w-full leading-none text-slate-400 text-base font-mono">
31+
<div class="p-3 w-full leading-none text-slate-400 text-sm font-mono">
3232
{props.name ?? ""}
3333
</div>
3434
</div>

www/components/PageSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function PageSection(props: JSX.HTMLAttributes<HTMLDivElement>) {
44
return (
55
<section
66
id={props.id ?? ""}
7-
class={`w-full max-w-screen-xl mx-auto my-16 md:my-24 lg:my-32 px-4 sm:px-8 lg:px-16 2xl:px-0 flex flex-col gap-8 md:gap-16 ${
7+
class={`w-full max-w-screen-xl mx-auto my-12 md:my-16 lg:my-24 px-4 sm:px-8 lg:px-16 2xl:px-0 flex flex-col gap-6 md:gap-8 ${
88
props.class ?? ""
99
}`}
1010
>

www/components/SideBySide.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function SideBySide(props: SideBySideProps) {
2626

2727
return (
2828
<div
29-
class={`grid grid-cols-1 items-center gap-12 md:gap-16 xl:gap-32 ${
29+
class={`grid grid-cols-1 items-center gap-8 md:gap-10 xl:gap-16 ${
3030
props.reverseOnDesktop ? "[&>*]:md:first:order-1" : ""
3131
} ${mdSplitClass} ${lgSplitClass} ${props.class ?? ""}`}
3232
>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { CodeBlock } from "../../components/CodeBlock.tsx";
2+
import { CodeWindow } from "../../components/CodeWindow.tsx";
3+
import { PageSection } from "../../components/PageSection.tsx";
4+
import { SideBySide } from "../../components/SideBySide.tsx";
5+
import { SectionHeading } from "../../components/homepage/SectionHeading.tsx";
6+
import { FancyLink } from "../../components/FancyLink.tsx";
7+
8+
const apiCode = `import { createDefine } from "fresh";
9+
const define = createDefine();
10+
11+
export const handlers = define.handlers({
12+
GET(ctx) {
13+
const user = db.getUser(ctx.params.id);
14+
return Response.json(user);
15+
},
16+
POST(ctx) {
17+
const body = await ctx.req.json();
18+
const user = db.updateUser(ctx.params.id, body);
19+
return Response.json(user);
20+
},
21+
DELETE(ctx) {
22+
db.deleteUser(ctx.params.id);
23+
return new Response(null, { status: 204 });
24+
},
25+
});`;
26+
27+
export function APIRoutesSection() {
28+
return (
29+
<PageSection>
30+
<SideBySide
31+
mdColSplit="3/2"
32+
lgColSplit="3/2"
33+
reverseOnDesktop
34+
class="!items-start"
35+
>
36+
<div class="flex flex-col gap-4 md:sticky md:top-4">
37+
<svg
38+
aria-hidden="true"
39+
xmlns="http://www.w3.org/2000/svg"
40+
class="icon icon-tabler icon-tabler-api text-fresh"
41+
width="2.5rem"
42+
height="2.5rem"
43+
viewBox="0 0 24 24"
44+
stroke-width="1.5"
45+
stroke="currentColor"
46+
fill="none"
47+
stroke-linecap="round"
48+
stroke-linejoin="round"
49+
>
50+
<title>API routes icon</title>
51+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
52+
<path d="M4 13h5" />
53+
<path d="M12 16v-8h3a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-3" />
54+
<path d="M20 8v8" />
55+
<path d="M9 16v-5.5a2.5 2.5 0 0 0 -5 0v5.5" />
56+
</svg>
57+
<SectionHeading>Handlers for every method</SectionHeading>
58+
<p>
59+
Define{" "}
60+
<code class="bg-gray-100 px-1.5 py-0.5 rounded text-sm font-mono">
61+
GET
62+
</code>,{" "}
63+
<code class="bg-gray-100 px-1.5 py-0.5 rounded text-sm font-mono">
64+
POST
65+
</code>,{" "}
66+
<code class="bg-gray-100 px-1.5 py-0.5 rounded text-sm font-mono">
67+
DELETE
68+
</code>{" "}
69+
— any HTTP method as a named handler on your route. Fresh maps
70+
requests to the right function automatically, with full type safety.
71+
</p>
72+
<FancyLink href="/docs/concepts/routing" class="mt-2">
73+
Learn about handlers
74+
</FancyLink>
75+
</div>
76+
<div class="flex flex-col gap-4">
77+
<CodeWindow name="routes/users/[id].tsx">
78+
<CodeBlock code={apiCode} lang="js" />
79+
</CodeWindow>
80+
</div>
81+
</SideBySide>
82+
</PageSection>
83+
);
84+
}

www/components/homepage/DemoBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function DemoBox(props: DemoBoxProps) {
99
const innerFlip = props.flip ? "skew-y-2 skew-x-3" : "-skew-y-2 -skew-x-3";
1010
return (
1111
<div
12-
class={`bg-gradient-to-br font-medium from-blue-200 via-green-300 to-yellow-200 p-8 py-12 text-center items-center flex justify-center ${outerFlip}`}
12+
class={`bg-gradient-to-br font-medium from-blue-200 via-green-300 to-yellow-200 p-5 py-8 text-center items-center flex justify-center text-sm ${outerFlip}`}
1313
>
1414
<div class={`w-full ${innerFlip}`}>
1515
{props.children}

0 commit comments

Comments
 (0)