www: refresh home page (#2418)
Overhauls the Fresh homepage with a new design, new demos, and new sections highlighting Fresh's capabilities. --------- Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
3b68a5d455
commit
e8d1a68b58
@@ -0,0 +1,85 @@
|
||||
import Counter from "$fresh/www/islands/Counter.tsx";
|
||||
import { CodeBlock } from "$fresh/www/components/CodeBlock.tsx";
|
||||
import { CodeWindow } from "$fresh/www/components/CodeWindow.tsx";
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { SideBySide } from "$fresh/www/components/SideBySide.tsx";
|
||||
import { SectionHeading } from "$fresh/www/components/homepage/SectionHeading.tsx";
|
||||
import { DemoBox } from "$fresh/www/components/homepage/DemoBox.tsx";
|
||||
import { ExampleArrow } from "$fresh/www/components/homepage/ExampleArrow.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
|
||||
const islandCode = `import { useSignal } from "@preact/signals";
|
||||
|
||||
export default function Counter(props) {
|
||||
const count = useSignal(props.start);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h3>Interactive island</h3>
|
||||
<p>The server supplied the initial value of {props.start}.</p>
|
||||
<div>
|
||||
<button onClick={() => count.value -= 1}>-</button>
|
||||
<div>{count}</div>
|
||||
<button onClick={() => count.value += 1}>+</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}`;
|
||||
|
||||
export function IslandsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="3/2" lgColSplit="3/2" reverseOnDesktop={true}>
|
||||
<div class="flex flex-col gap-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-beach text-fresh"
|
||||
width="4rem"
|
||||
height="4rem"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M17.553 16.75a7.5 7.5 0 0 0 -10.606 0" />
|
||||
<path d="M18 3.804a6 6 0 0 0 -8.196 2.196l10.392 6a6 6 0 0 0 -2.196 -8.196z" />
|
||||
<path d="M16.732 10c1.658 -2.87 2.225 -5.644 1.268 -6.196c-.957 -.552 -3.075 1.326 -4.732 4.196" />
|
||||
<path d="M15 9l-3 5.196" />
|
||||
<path d="M3 19.25a2.4 2.4 0 0 1 1 -.25a2.4 2.4 0 0 1 2 1a2.4 2.4 0 0 0 2 1a2.4 2.4 0 0 0 2 -1a2.4 2.4 0 0 1 2 -1a2.4 2.4 0 0 1 2 1a2.4 2.4 0 0 0 2 1a2.4 2.4 0 0 0 2 -1a2.4 2.4 0 0 1 2 -1a2.4 2.4 0 0 1 1 .25" />
|
||||
</svg>
|
||||
<SectionHeading>Island-based architecture</SectionHeading>
|
||||
<p>
|
||||
Fresh ships plain HTML to the client, and then hydrates with
|
||||
JavaScript only where needed.
|
||||
</p>
|
||||
<p>
|
||||
Because it's{" "}
|
||||
<a href="https://preactjs.com/" class="underline">Preact</a>, you
|
||||
get best-in-class performance, plus the convenience of{" "}
|
||||
<a href="https://preactjs.com/guide/v10/signals/" class="underline">
|
||||
Signals
|
||||
</a>.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/islands" class="mt-2">
|
||||
Learn more about islands
|
||||
</FancyLink>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4 relative">
|
||||
<CodeWindow name="islands/Counter.tsx">
|
||||
<CodeBlock
|
||||
code={islandCode}
|
||||
lang="jsx"
|
||||
/>
|
||||
</CodeWindow>
|
||||
<ExampleArrow class="[transform:rotateY(-180deg)]" />
|
||||
<DemoBox flip={true}>
|
||||
<Counter start={3} />
|
||||
</DemoBox>
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user