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
@@ -1,13 +0,0 @@
|
||||
import { JSX } from "preact";
|
||||
|
||||
export function RoundedButton(props: JSX.HTMLAttributes<HTMLButtonElement>) {
|
||||
return (
|
||||
<button
|
||||
style={{
|
||||
touchAction: "manipulation",
|
||||
}}
|
||||
{...props}
|
||||
class="p-3 border border-transparent rounded-full text-white bg-green-500 hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-green-200 disabled:cursor-default"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import Prism from "$prism";
|
||||
|
||||
export function CodeBlock(
|
||||
{ code, lang }: { code: string; lang: "js" | "ts" | "jsx" | "md" | "bash" },
|
||||
) {
|
||||
return (
|
||||
<pre
|
||||
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"
|
||||
data-language={lang}
|
||||
><code dangerouslySetInnerHTML={{ __html: Prism.highlight(code, Prism.languages[lang], lang)}} /></pre>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { JSX } from "preact";
|
||||
|
||||
interface CodeWindowProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export function CodeWindow(props: CodeWindowProps) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
class={`rounded-lg bg-slate-700 overflow-hidden w-full max-w-full [&>*]:rounded-t-none ${
|
||||
props.class ?? ""
|
||||
}`}
|
||||
style={props.style}
|
||||
>
|
||||
<div class="flex items-stretch justify-start">
|
||||
<div class="p-4 flex items-center">
|
||||
<svg
|
||||
width="41"
|
||||
height="10"
|
||||
viewBox="0 0 41 10"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<ellipse cx="20.9388" cy="5" rx="4.99155" ry="5" fill="#FFBD2D" />
|
||||
<ellipse cx="5.96421" cy="5" rx="4.99155" ry="5" fill="#FF5F56" />
|
||||
<ellipse cx="35.9134" cy="5" rx="4.99155" ry="5" fill="#26C940" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="p-4 w-full leading-none text-slate-400 text-base font-mono">
|
||||
{props.name ?? ""}
|
||||
</div>
|
||||
</div>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { ComponentChildren } from "preact";
|
||||
|
||||
export function FancyLink(
|
||||
props: { href: string; children: ComponentChildren; class?: string },
|
||||
) {
|
||||
return (
|
||||
<a
|
||||
href={props.href}
|
||||
class={`group p-4 px-5 pb-3.5 bg-gradient-to-br from-fresh/40 to-fresh font-semibold rounded leading-none flex items-center justify-center hover:bg-fresh transition-colors duration-200 ease-in-out max-w-max text-balance ${
|
||||
props.class ?? ""
|
||||
}`}
|
||||
>
|
||||
{props.children}
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-arrow-right relative ml-2 bottom-[0.05em] transition-transform ease-out duration-150 group-hover:translate-x-1"
|
||||
width="1em"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="3"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M5 12l14 0" />
|
||||
<path d="M13 18l6 -6" />
|
||||
<path d="M13 6l6 6" />
|
||||
</svg>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import PropsDemo from "$fresh/tests/fixture_partials/routes/island_props_signals/index.tsx";
|
||||
import * as Icons from "./Icons.tsx";
|
||||
import { JSX } from "preact";
|
||||
|
||||
const LINKS = [
|
||||
{
|
||||
@@ -15,9 +17,11 @@ const LINKS = [
|
||||
},
|
||||
];
|
||||
|
||||
export default function Footer() {
|
||||
export default function Footer(props: JSX.HTMLAttributes<HTMLElement>) {
|
||||
return (
|
||||
<footer class="border-t-2 border-gray-200 md:h-16 flex mt-16 justify-center md:mx-16">
|
||||
<footer
|
||||
class={`border-t-2 border-gray-200 md:h-16 flex mt-16 justify-center md:mx-16 ${props.class}`}
|
||||
>
|
||||
<div class="flex flex-col sm:flex-row gap-4 justify-between items-center max-w-screen-xl mx-auto w-full sm:px-6 md:px-8 p-4">
|
||||
<div class="text-gray-600 text-center">
|
||||
<span>© {new Date().getFullYear()} the Fresh authors</span>
|
||||
|
||||
@@ -10,7 +10,7 @@ export default function Header(props: { title: string; active: string }) {
|
||||
{isDocs
|
||||
? (
|
||||
<header
|
||||
class={" top-0 w-full bg-white mx-auto max-w-screen-xl flex gap-3 items-center " +
|
||||
class={" top-0 w-full bg-transparent mx-auto max-w-screen-xl flex gap-3 items-center " +
|
||||
"justify-between md:justify-end"}
|
||||
f-client-nav={false}
|
||||
>
|
||||
@@ -19,12 +19,12 @@ export default function Header(props: { title: string; active: string }) {
|
||||
<DocsTitle />
|
||||
</div>
|
||||
|
||||
<NavigationBar class="hidden md:flex" active={props.active} />
|
||||
<NavigationBar class="" active={props.active} />
|
||||
</header>
|
||||
)
|
||||
: (
|
||||
<header
|
||||
class={"mx-auto max-w-screen-xl flex gap-3 items-center " +
|
||||
class={"h-20 mx-auto max-w-screen-xl flex gap-3 items-center " +
|
||||
(isHome ? "justify-end" : "justify-between")}
|
||||
f-client-nav={false}
|
||||
>
|
||||
@@ -34,11 +34,9 @@ export default function Header(props: { title: string; active: string }) {
|
||||
<DocsTitle />
|
||||
</div>
|
||||
)}
|
||||
<NavigationBar class="hidden md:flex" active={props.active} />
|
||||
<NavigationBar class="" active={props.active} />
|
||||
</header>
|
||||
)}
|
||||
|
||||
<NavigationBar class="md:hidden pb-3" active={props.active} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ export default function NavigationBar(
|
||||
name: "Showcase",
|
||||
href: "/showcase",
|
||||
},
|
||||
{
|
||||
name: "Components",
|
||||
href: "/components",
|
||||
},
|
||||
// {
|
||||
// name: "Components",
|
||||
// href: "/components",
|
||||
// },
|
||||
{
|
||||
name: "Blog",
|
||||
href: "https://deno.com/blog?tag=fresh",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { JSX } from "preact";
|
||||
|
||||
export function PageSection(props: JSX.HTMLAttributes<HTMLDivElement>) {
|
||||
return (
|
||||
<section
|
||||
class={`w-full max-w-screen-xl mx-auto my-8 sm: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 ${
|
||||
props.class ?? ""
|
||||
}`}
|
||||
>
|
||||
{props.children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { JSX } from "preact/jsx-runtime";
|
||||
|
||||
type ColumnConfiguration = "1/1" | "2/3" | "3/2";
|
||||
|
||||
interface SideBySideProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
||||
mdColSplit?: ColumnConfiguration;
|
||||
lgColSplit?: ColumnConfiguration;
|
||||
reverseOnDesktop?: boolean;
|
||||
}
|
||||
|
||||
export function SideBySide(props: SideBySideProps) {
|
||||
let mdSplitClass = "md:grid-cols-2";
|
||||
let lgSplitClass = "lg:grid-cols-2";
|
||||
|
||||
if (props.mdColSplit === "2/3") {
|
||||
mdSplitClass = "md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]";
|
||||
} else if (props.mdColSplit === "3/2") {
|
||||
mdSplitClass = "md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]";
|
||||
}
|
||||
|
||||
if (props.lgColSplit === "2/3") {
|
||||
lgSplitClass = " lg:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]";
|
||||
} else if (props.lgColSplit === "3/2") {
|
||||
lgSplitClass = "lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]";
|
||||
}
|
||||
|
||||
const swapClass = props.reverseOnDesktop ? "swap-on-mobile" : "";
|
||||
|
||||
return (
|
||||
<div
|
||||
class={`grid grid-cols-1 items-center gap-8 md:gap-16 xl:gap-32 ${
|
||||
props.reverseOnDesktop ? "md:first:[&>*]:order-1" : ""
|
||||
} ${mdSplitClass} ${lgSplitClass} ${props.class ?? ""}`}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ type Props = {
|
||||
export default function Header({ active }: Props) {
|
||||
const menus = [
|
||||
{ name: "Home", href: "/" },
|
||||
{ name: "Components", href: "/components" },
|
||||
// { name: "Components", href: "/components" },
|
||||
{ name: "Docs", href: "/docs" },
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
|
||||
export function CTA() {
|
||||
return (
|
||||
<div
|
||||
class="bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100 pb-32"
|
||||
style="clip-path: polygon(0% 10%, 0% 100%, 100% 100%, 100% 0%)"
|
||||
>
|
||||
<PageSection class="text-center">
|
||||
<div class="flex flex-col gap-4">
|
||||
<img
|
||||
src="/lemon.svg"
|
||||
alt="Illustration of a lemon sliced cleanly in half, suspended in midair as though frozen in time the instant after the cut, the juice flung from the edges"
|
||||
class="w-full max-w-64 mx-auto mb-8"
|
||||
/>
|
||||
<h2 class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl text-gray-600 font-extrabold">
|
||||
Time for a Fresh Start
|
||||
</h2>
|
||||
<div class="flex flex-col justify-start items-center gap-4">
|
||||
<p class="text-xl">
|
||||
Jump right in and build your website with Fresh. Learn everything
|
||||
you need to know in seconds.
|
||||
</p>
|
||||
<FancyLink
|
||||
href="/docs/getting-started"
|
||||
class="mx-auto mt-4"
|
||||
>
|
||||
Get started
|
||||
</FancyLink>
|
||||
</div>
|
||||
</div>
|
||||
</PageSection>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { JSX } from "preact";
|
||||
|
||||
interface DemoBoxProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
||||
flip?: boolean;
|
||||
}
|
||||
|
||||
export function DemoBox(props: DemoBoxProps) {
|
||||
const outerFlip = props.flip ? "-skew-y-2 -skew-x-3" : "skew-y-2 skew-x-3";
|
||||
const innerFlip = props.flip ? "skew-y-2 skew-x-3" : "-skew-y-2 -skew-x-3";
|
||||
return (
|
||||
<div
|
||||
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}`}
|
||||
>
|
||||
<div class={`w-full ${innerFlip}`}>
|
||||
{props.children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
import { SideBySide } from "$fresh/www/components/SideBySide.tsx";
|
||||
import { SectionHeading } from "$fresh/www/components/homepage/SectionHeading.tsx";
|
||||
|
||||
export function DenoSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide reverseOnDesktop={true}>
|
||||
<img
|
||||
src="/illustration/lemon-squash.svg"
|
||||
class="w-full h-auto mx-auto max-w-[24rem] mt-8 mb-4"
|
||||
alt="Deno is drinking Fresh lemon squash"
|
||||
/>
|
||||
<div class="flex flex-col gap-4">
|
||||
<SectionHeading>
|
||||
Built on Deno
|
||||
</SectionHeading>
|
||||
<p>
|
||||
Deno is the next evolution of server-side JavaScript, with stronger
|
||||
security, a robust built-in toolchain, and zero-config TypeScript
|
||||
support. (It's faster than Node, too.)
|
||||
</p>
|
||||
<FancyLink
|
||||
href="https://deno.com"
|
||||
class="mt-4"
|
||||
>
|
||||
Learn more about Deno
|
||||
</FancyLink>
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { JSX } from "preact";
|
||||
|
||||
export function ExampleArrow(
|
||||
props: JSX.HTMLAttributes<HTMLDivElement>,
|
||||
) {
|
||||
return (
|
||||
<svg
|
||||
width="100%"
|
||||
height="100%"
|
||||
viewBox="0 0 137 291"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xml:space="preserve"
|
||||
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"
|
||||
class={`w-12 -my-8 relative z-10 mx-auto ${props?.class ?? ""}`}
|
||||
>
|
||||
<path
|
||||
d="M50.704,18c46.89,80.967 38.288,189.344 5.941,254.255"
|
||||
style="fill:none;stroke:#fff;stroke-width:36px;"
|
||||
/>
|
||||
<path
|
||||
d="M18,207.944c13.297,11.903 33.957,43.376 38.645,64.311c19.034,-17.758 43.173,-31.125 62.237,-36.621"
|
||||
style="fill:none;stroke:#fff;stroke-width:36px;"
|
||||
/>
|
||||
<path
|
||||
d="M50.704,18c47.238,81.059 38.288,189.344 5.941,254.255"
|
||||
style="fill:none;stroke-width:18px;"
|
||||
class="stroke-gray-600"
|
||||
/>
|
||||
<path
|
||||
d="M18,207.944c13.044,11.646 33.957,43.376 38.645,64.311c19.034,-17.758 43.173,-31.125 62.237,-36.621"
|
||||
style="fill:none;stroke-width:18px;"
|
||||
class="stroke-gray-600"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { SideBySide } from "$fresh/www/components/SideBySide.tsx";
|
||||
import { CodeWindow } from "$fresh/www/components/CodeWindow.tsx";
|
||||
import { CodeBlock } from "$fresh/www/components/CodeBlock.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 routingCode = `import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async POST(req, ctx) {
|
||||
const form = await req.formData();
|
||||
const email = form.get("email")?.toString();
|
||||
|
||||
// Save email to database here
|
||||
|
||||
// Redirect user to thank you page.
|
||||
const headers = new Headers();
|
||||
headers.set("location", "/thanks-for-subscribing");
|
||||
return new Response(null, {
|
||||
status: 303,
|
||||
headers,
|
||||
});
|
||||
},
|
||||
};`;
|
||||
|
||||
export function FormsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div
|
||||
role="img"
|
||||
alt="Arrows routing and crossing each other emoji"
|
||||
class="leading-none text-[4rem]"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-route-square-2 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="M14 5a2 2 0 0 0 -2 2v10a2 2 0 0 1 -2 2" />
|
||||
<path d="M3 17h4v4h-4z" />
|
||||
<path d="M17 3h4v4h-4z" />
|
||||
</svg>
|
||||
</div>
|
||||
<SectionHeading>
|
||||
Forms, the right way
|
||||
</SectionHeading>
|
||||
<p>
|
||||
Don't fight the browser. Fresh helps you handle form submissions and
|
||||
other dynamic requests server-side, simply and easily.
|
||||
</p>
|
||||
<p>
|
||||
Since Fresh is built on{" "}
|
||||
<a href="https://deno.com" class="underline">Deno</a>, it's built on
|
||||
web standards.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/forms" class="mt-2">
|
||||
Forms in Fresh
|
||||
</FancyLink>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4">
|
||||
<CodeWindow name="routes/index.tsx">
|
||||
<CodeBlock
|
||||
code={routingCode}
|
||||
lang="jsx"
|
||||
/>
|
||||
</CodeWindow>
|
||||
{
|
||||
/* <ExampleArrow />
|
||||
<DemoBox>
|
||||
<p>
|
||||
TODO: something goes here.
|
||||
</p>
|
||||
</DemoBox> */
|
||||
}
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import CopyArea from "../../islands/CopyArea.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
import LemonDrop from "$fresh/www/islands/LemonDrop.tsx";
|
||||
import LemonTop from "$fresh/www/islands/LemonTop.tsx";
|
||||
import LemonBottom from "$fresh/www/islands/LemonBottom.tsx";
|
||||
|
||||
export function Hero(props: { origin: string }) {
|
||||
return (
|
||||
<>
|
||||
<div class="bg-green-300 mt-0 pt-32 md:pt-48 !mb-0 bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100">
|
||||
<div class="md:grid grid-cols-5 gap-8 md:gap-16 items-center w-full max-w-screen-xl mx-auto px-4 md:px-8 lg:px-16 2xl:px-0">
|
||||
<div class="flex-1 text-center md:text-left md:col-span-3 pb-8 md:pb-32">
|
||||
<h2 class="text-4xl sm:text-5xl lg:text-6xl sm:tracking-tight sm:leading-none! font-extrabold">
|
||||
The simple, approachable, productive web framework
|
||||
</h2>
|
||||
<div class="mt-12 flex flex-wrap justify-center items-stretch md:justify-start gap-4">
|
||||
<FancyLink href="/docs/getting-started">Get started</FancyLink>
|
||||
<CopyArea code={`deno run -A -r ${props.origin}`} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:col-span-2 flex justify-center items-end">
|
||||
<LemonTop />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<LemonBottom />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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 { RecipeDemo } from "$fresh/www/components/homepage/RecipeDemo.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
|
||||
const islandCode = `import { Partial } from "$fresh/runtime.ts";
|
||||
|
||||
export const Recipes = () => (
|
||||
<div f-client-nav>
|
||||
<aside>
|
||||
<button f-partial="/recipes/lemonade">
|
||||
Lemonade
|
||||
</button>
|
||||
<button f-partial="/recipes/lemon-honey-tea">
|
||||
Lemon-honey tea
|
||||
</button>
|
||||
<button f-partial="/recipes/lemondrop">
|
||||
Lemondrop Martini
|
||||
</button>
|
||||
</aside>
|
||||
<main>
|
||||
<Partial name="recipe">
|
||||
Click a recipe to stream HTML into this spot
|
||||
</Partial>
|
||||
</main>
|
||||
</div>
|
||||
);`;
|
||||
|
||||
export function PartialsSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="3/2" lgColSplit="3/2" reverseOnDesktop={true}>
|
||||
<div class="flex flex-col gap-4">
|
||||
<svg
|
||||
role="img"
|
||||
alt="Arrows transferring data down "
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-arrows-transfer-down 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 3v6" />
|
||||
<path d="M10 18l-3 3l-3 -3" />
|
||||
<path d="M7 21v-18" />
|
||||
<path d="M20 6l-3 -3l-3 3" />
|
||||
<path d="M17 21v-2" />
|
||||
<path d="M17 15v-2" />
|
||||
</svg>
|
||||
|
||||
<SectionHeading>Stream HTML straight from the server</SectionHeading>
|
||||
<p>
|
||||
Fresh Partials let you fetch HTML and update only the parts of the
|
||||
page that need to change, without reloading the entire page.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/partials" class="mt-4">
|
||||
Learn more about Partials
|
||||
</FancyLink>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4">
|
||||
<CodeWindow name="components/Recipes.tsx">
|
||||
<CodeBlock
|
||||
code={islandCode}
|
||||
lang="jsx"
|
||||
/>
|
||||
</CodeWindow>
|
||||
<ExampleArrow class="[transform:rotateY(-180deg)]" />
|
||||
<DemoBox flip={true}>
|
||||
<RecipeDemo />
|
||||
</DemoBox>
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
|
||||
export const RecipeDemo = () => (
|
||||
<div
|
||||
f-client-nav
|
||||
class="w-full grid grid-cols-1 md:grid-cols-[auto_1fr] text-left gap-6 items-stretch min-h-64"
|
||||
>
|
||||
<aside class="flex flex-col gap-2 underline p-6 pl-0 border-b md:border-r md:border-b-0 border-current text-left items-start justify-center">
|
||||
<button f-partial="/recipes/lemonade">
|
||||
Lemonade
|
||||
</button>
|
||||
<button f-partial="/recipes/lemon-honey-tea">
|
||||
Lemon-honey tea
|
||||
</button>
|
||||
<button f-partial="/recipes/lemondrop">
|
||||
Lemondrop Martini
|
||||
</button>
|
||||
</aside>
|
||||
<main class="w-full flex flex-col justify-center">
|
||||
<Partial name="recipe">
|
||||
Click a recipe to stream HTML into this spot
|
||||
</Partial>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
@@ -0,0 +1,66 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { SideBySide } from "$fresh/www/components/SideBySide.tsx";
|
||||
import { CodeWindow } from "$fresh/www/components/CodeWindow.tsx";
|
||||
import { CodeBlock } from "$fresh/www/components/CodeBlock.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";
|
||||
|
||||
const serverCode = `export default function HomePage() {
|
||||
const time = new Date().toLocaleString();
|
||||
return (
|
||||
<p>Freshly server-rendered {time}</p>
|
||||
);
|
||||
}`;
|
||||
|
||||
export function RenderingSection() {
|
||||
return (
|
||||
<PageSection>
|
||||
<SideBySide mdColSplit="2/3" lgColSplit="2/3">
|
||||
<div class="flex flex-col gap-4">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon icon-tabler icon-tabler-atom 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"
|
||||
role="img"
|
||||
alt="Preact icon"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M12 12v.01" />
|
||||
<path d="M19.071 4.929c-1.562 -1.562 -6 .337 -9.9 4.243c-3.905 3.905 -5.804 8.337 -4.242 9.9c1.562 1.561 6 -.338 9.9 -4.244c3.905 -3.905 5.804 -8.337 4.242 -9.9" />
|
||||
<path d="M4.929 4.929c-1.562 1.562 .337 6 4.243 9.9c3.905 3.905 8.337 5.804 9.9 4.242c1.561 -1.562 -.338 -6 -4.244 -9.9c-3.905 -3.905 -8.337 -5.804 -9.9 -4.242" />
|
||||
</svg>
|
||||
<SectionHeading>
|
||||
Build fast apps fast
|
||||
</SectionHeading>
|
||||
<p>
|
||||
Fresh routes are dynamically server-rendered Preact components, so
|
||||
there's zero JavaScript shipped to the browser by default.
|
||||
</p>
|
||||
<p>Simple to write; fast to run.</p>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4">
|
||||
<CodeWindow name="routes/index.tsx">
|
||||
<CodeBlock code={serverCode} lang="jsx" />
|
||||
</CodeWindow>
|
||||
<ExampleArrow class="ml-[55%]" />{" "}
|
||||
<DemoBox>
|
||||
<p>
|
||||
Freshly server-rendered {new Date().toLocaleString("default", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "medium",
|
||||
})}
|
||||
</p>
|
||||
</DemoBox>
|
||||
</div>
|
||||
</SideBySide>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ComponentChildren } from "preact";
|
||||
|
||||
export function SectionHeading(
|
||||
{ children }: { children: ComponentChildren },
|
||||
) {
|
||||
return (
|
||||
<h2 class="text-3xl lg:text-4xl xl:text-5xl text-gray-600 font-bold text-balance">
|
||||
{children}
|
||||
</h2>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
|
||||
export function Simple() {
|
||||
return (
|
||||
<PageSection class="!my-16">
|
||||
<div class="text-center max-w-max mx-auto flex flex-col gap-4">
|
||||
<p class="italic text-gray-500 text-lg">Introducing Fresh:</p>
|
||||
<h2 class="text-4xl sm:text-5xl md:text-6xl lg:text-7xl sm:tracking-tight sm:leading-[1.1]! font-extrabold text-balance text-gray-600">
|
||||
The framework so simple, you already know it.
|
||||
</h2>
|
||||
<p class="text-xl text-balance max-w-prose mx-auto">
|
||||
Fresh is designed to be easy to use by building on the best well-known
|
||||
tools, conventions, and web standards.
|
||||
</p>
|
||||
</div>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { PageSection } from "$fresh/www/components/PageSection.tsx";
|
||||
import { FancyLink } from "$fresh/www/components/FancyLink.tsx";
|
||||
import { DemoBox } from "$fresh/www/components/homepage/DemoBox.tsx";
|
||||
|
||||
export function SocialProof() {
|
||||
return (
|
||||
<PageSection>
|
||||
<div class="text-center max-w-max mx-auto flex flex-col gap-4">
|
||||
<h2 class="text-gray-600 text-4xl sm:text-5xl md:text-6xl lg:text-7xl sm:tracking-tight sm:leading-[1.1]! font-extrabold text-balance">
|
||||
Built for the edge
|
||||
</h2>
|
||||
<p class="text-xl text-balance max-w-prose mx-auto">
|
||||
Fresh is the secret sauce behind production-grade, enterprise-ready
|
||||
software like{" "}
|
||||
<a href="https://deco.cx" class="underline">Deco.cx</a>, Brazil's top
|
||||
eCommerce platform
|
||||
</p>
|
||||
</div>
|
||||
<a href="https://deno.com/blog/deco-cx-subhosting-serve-their-clients-storefronts-fast">
|
||||
<img
|
||||
src="/showcase/deco.webp"
|
||||
alt="Deco CX"
|
||||
class="mx-auto"
|
||||
loading="lazy"
|
||||
/>
|
||||
</a>
|
||||
<div class="flex flex-col gap-8 items-center justify-center -mt-8 md:-mt-16 lg:-mt-32">
|
||||
<DemoBox flip={true}>
|
||||
<blockquote class="text-center italic text-lg sm:text-xl md:text-2xl lg:text-2xl xl:text-3xl max-w-screen-md text-gray-700 text-balance font-normal border-l-yellow-300 mx-auto my-4">
|
||||
<span class="font-semibold inline-block transform scale-150 relative -left-3 top-1 leading-none">
|
||||
“
|
||||
</span>The team also used{" "}
|
||||
<b>Fresh</b>, a next-gen Deno-native full stack web framework that
|
||||
sends zero JavaScript to the client, for its modern developer
|
||||
experience and snappy performance…<br />
|
||||
<br />This stack unlocked{" "}
|
||||
<b>
|
||||
5x faster page load speeds and a 30% jump in conversion rates
|
||||
</b>{" "}
|
||||
for their
|
||||
clients.<span class="font-semibold inline-block transform scale-150 relative -right-2 top-1 leading-none">
|
||||
”
|
||||
</span>
|
||||
</blockquote>
|
||||
</DemoBox>
|
||||
<FancyLink
|
||||
href="https://deno.com/blog/deco-cx-subhosting-serve-their-clients-storefronts-fast"
|
||||
class="mt-8"
|
||||
>
|
||||
Read the case study
|
||||
</FancyLink>
|
||||
</div>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user