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:
Josh Collinsworth
2024-05-17 16:08:55 +02:00
committed by GitHub
co-authored by Marvin Hagemeister
parent 3b68a5d455
commit e8d1a68b58
55 changed files with 1206 additions and 346 deletions
+1
View File
@@ -2,3 +2,4 @@ _fresh/
tmp/
vendor/
node_modules/
.DS_Store
+2
View File
@@ -12,6 +12,8 @@
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.5.1",
"@preact/signals-core@1.2.3": "https://esm.sh/@preact/signals-core@1.2.3",
"@preact/signals-core@1.3.0": "https://esm.sh/@preact/signals-core@1.3.0",
"$prism": "https://esm.sh/prismjs@1.29.0",
"$prism/": "https://esm.sh/prismjs@1.29.0/",
"$std/": "https://deno.land/std@0.216.0/",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
"$marked-mangle": "https://esm.sh/marked-mangle@1.0.1",
+8 -1
View File
@@ -1,2 +1,9 @@
[files]
extend-exclude = ["tests/fixture_partials/routes/scroll_restoration/index.tsx"]
extend-exclude = [
"tests/fixture_partials/routes/scroll_restoration/index.tsx",
"www/static/fonts/FixelVariable.woff2",
"www/static/fonts/FixelVariableItalic.woff2",
]
[default]
extend-ignore-identifiers-re = ["Fixel"]
+2 -2
View File
@@ -7,10 +7,10 @@ describe("components/gallery/Header.tsx", () => {
beforeAll(setup);
afterEach(cleanup);
it("should show 3 links", () => {
it("should show 2 links", () => {
const screen = render(<Header active="" />);
const links = screen.getAllByRole("link");
assertEquals(links.length, 3);
assertEquals(links.length, 2);
});
it("should show '/docs' as active", () => {
-13
View File
@@ -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"
/>
);
}
+12
View File
@@ -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>
);
}
+37
View File
@@ -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>
);
}
+34
View File
@@ -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>
);
}
+6 -2
View File
@@ -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>
+4 -6
View File
@@ -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} />
</>
);
}
+4 -4
View File
@@ -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",
+13
View File
@@ -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>
);
}
+38
View File
@@ -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>
);
}
+1 -1
View File
@@ -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" },
];
+36
View File
@@ -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>
);
}
+19
View File
@@ -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>
);
}
+34
View File
@@ -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>
);
}
+37
View File
@@ -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>
);
}
+92
View File
@@ -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>
);
}
+30
View File
@@ -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>
);
}
+25
View File
@@ -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>
);
}
+18
View File
@@ -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>
);
}
+55
View File
@@ -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>
);
}
+2
View File
@@ -12,6 +12,8 @@
"preact/": "https://esm.sh/preact@10.19.6/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.5.1",
"$prism": "https://esm.sh/prismjs@1.29.0",
"$prism/": "https://esm.sh/prismjs@1.29.0/",
"$std/": "https://deno.land/std@0.216.0/",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
"$marked-mangle": "https://esm.sh/marked-mangle@1.1.7",
+12 -2
View File
@@ -6,18 +6,23 @@ import * as $_404 from "./routes/_404.tsx";
import * as $_500 from "./routes/_500.tsx";
import * as $_app from "./routes/_app.tsx";
import * as $_middleware from "./routes/_middleware.ts";
import * as $components from "./routes/components.tsx";
import * as $docs_slug_ from "./routes/docs/[...slug].tsx";
import * as $docs_middleware from "./routes/docs/_middleware.ts";
import * as $docs_index from "./routes/docs/index.tsx";
import * as $index from "./routes/index.tsx";
import * as $raw from "./routes/raw.ts";
import * as $recipes_layout from "./routes/recipes/_layout.tsx";
import * as $recipes_lemon_honey_tea from "./routes/recipes/lemon-honey-tea.tsx";
import * as $recipes_lemonade from "./routes/recipes/lemonade.tsx";
import * as $recipes_lemondrop from "./routes/recipes/lemondrop.tsx";
import * as $showcase from "./routes/showcase.tsx";
import * as $update from "./routes/update.tsx";
import * as $ComponentGallery from "./islands/ComponentGallery.tsx";
import * as $CopyArea from "./islands/CopyArea.tsx";
import * as $Counter from "./islands/Counter.tsx";
import * as $LemonBottom from "./islands/LemonBottom.tsx";
import * as $LemonDrop from "./islands/LemonDrop.tsx";
import * as $LemonTop from "./islands/LemonTop.tsx";
import * as $SearchButton from "./islands/SearchButton.tsx";
import * as $TableOfContents from "./islands/TableOfContents.tsx";
import * as $VersionSelect from "./islands/VersionSelect.tsx";
@@ -29,12 +34,15 @@ const manifest = {
"./routes/_500.tsx": $_500,
"./routes/_app.tsx": $_app,
"./routes/_middleware.ts": $_middleware,
"./routes/components.tsx": $components,
"./routes/docs/[...slug].tsx": $docs_slug_,
"./routes/docs/_middleware.ts": $docs_middleware,
"./routes/docs/index.tsx": $docs_index,
"./routes/index.tsx": $index,
"./routes/raw.ts": $raw,
"./routes/recipes/_layout.tsx": $recipes_layout,
"./routes/recipes/lemon-honey-tea.tsx": $recipes_lemon_honey_tea,
"./routes/recipes/lemonade.tsx": $recipes_lemonade,
"./routes/recipes/lemondrop.tsx": $recipes_lemondrop,
"./routes/showcase.tsx": $showcase,
"./routes/update.tsx": $update,
},
@@ -42,7 +50,9 @@ const manifest = {
"./islands/ComponentGallery.tsx": $ComponentGallery,
"./islands/CopyArea.tsx": $CopyArea,
"./islands/Counter.tsx": $Counter,
"./islands/LemonBottom.tsx": $LemonBottom,
"./islands/LemonDrop.tsx": $LemonDrop,
"./islands/LemonTop.tsx": $LemonTop,
"./islands/SearchButton.tsx": $SearchButton,
"./islands/TableOfContents.tsx": $TableOfContents,
"./islands/VersionSelect.tsx": $VersionSelect,
+4 -4
View File
@@ -26,17 +26,17 @@ export default function CopyArea(props: { code: string }) {
}
const timer = setTimeout(() => {
copied.value = false;
}, 2000);
}, 1000);
return () => clearTimeout(timer);
}, [copied.value]);
return (
<div class="bg-gray-800 rounded text-white flex items-center min-w-0">
<pre class="overflow-x-auto flex-1 py-2 px-4">
<div class="bg-slate-800 rounded text-green-100 flex items-center min-w-0 overflow-x-auto">
<pre class="overflow-x-auto w-full flex-1 px-6 py-4">
{props.code}
</pre>
<div class="relative my-2 mr-4">
<div class="relative my-2 mr-4 sm:mr-6">
<div
class={`hidden transition ease-in-out absolute pointer-events-none bg-gray-900 text-white p-2 -top-1/3 left-1/2 transform -translate-x-1/2 -translate-y-full box-border rounded opacity-0 ${
copied.value && "block opacity-100"
+17 -11
View File
@@ -1,7 +1,6 @@
import { useSignal } from "@preact/signals";
import { IS_BROWSER } from "$fresh/runtime.ts";
import { RoundedButton } from "../components/Button.tsx";
import * as Icons from "../components/Icons.tsx";
import { JSX } from "preact";
interface CounterProps {
start: number;
@@ -11,14 +10,11 @@ export default function Counter(props: CounterProps) {
const count = useSignal(props.start);
return (
<div
class="bg-green-100 p-8 border-8 border-green-300 text-center"
style="border-radius: 1rem"
>
<h3 class="green-300 text-2xl font-bold text-green-700">
This area is interactive
<div>
<h3 class="text-2xl font-bold">
Interactive island
</h3>
<p class="text-gray-600">
<p>
The server supplied the initial value of 3.
</p>
<div
@@ -28,7 +24,6 @@ export default function Counter(props: CounterProps) {
<RoundedButton
title="Subtract 1"
onClick={() => count.value -= 1}
disabled={!IS_BROWSER || count.value <= 0}
>
<Icons.IconMinus />
</RoundedButton>
@@ -39,7 +34,6 @@ export default function Counter(props: CounterProps) {
<RoundedButton
title="Add 1"
onClick={() => count.value += 1}
disabled={!IS_BROWSER}
>
<Icons.IconPlus />
</RoundedButton>
@@ -47,3 +41,15 @@ export default function Counter(props: CounterProps) {
</div>
);
}
function RoundedButton(props: JSX.HTMLAttributes<HTMLButtonElement>) {
return (
<button
style={{
touchAction: "manipulation",
}}
{...props}
class="p-3 rounded-full border-2 border-current bg-white/20 hover:bg-white/50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-green-200 disabled:cursor-default"
/>
);
}
+118
View File
@@ -0,0 +1,118 @@
import { useEffect, useRef } from "preact/hooks";
import { useSignal } from "@preact/signals";
import { WaveTank } from "../components/WaveTank.ts";
function easeInCirc(x: number) {
return 1 - Math.sqrt(1 - Math.pow(x, 2));
}
const waveTank = new WaveTank();
function LemonBottom() {
const SVG_WIDTH = 100;
const counter = useSignal(0);
const dropY = useSignal(60);
const width = useSignal(SVG_WIDTH);
const widthRef = useRef(width.value);
const springs = useSignal(waveTank.springs);
const requestIdRef = useRef<number>();
const grid = SVG_WIDTH / waveTank.waveLength;
let lemonTop: SVGElement | null;
let lemonTopLeft: number;
const points = [
[0, 100],
[0, 0],
...springs.value.map((x, i) => [i * grid, x.p]),
[width.value, 0],
[width.value, 100],
];
const springsPath = `${points.map((x) => x.join(",")).join(" ")}`;
function updateJuice(timestamp: number) {
const amp = 40;
const x = timestamp / 2000;
const saw = x - Math.floor(x);
if (saw < 0.6) {
counter.value = easeInCirc(saw) * amp;
dropY.value = -100;
} else {
counter.value = easeInCirc(1 - saw) * amp * 0.1;
dropY.value = 70 + Math.pow(saw - 0.6, 2) * 10000;
}
}
function update(timestamp: number) {
updateJuice(timestamp);
waveTank.update(waveTank.springs);
springs.value = [...waveTank.springs];
const offset = 500;
const saw = (timestamp + offset) / 2000 -
Math.floor((timestamp + offset) / 2000);
if (saw < 0.01) {
drop();
}
requestIdRef.current = globalThis.requestAnimationFrame(update);
}
function resize() {
width.value = document.body.clientWidth;
lemonTop = document.querySelector("#lemon-top");
lemonTopLeft = lemonTop ? lemonTop.getBoundingClientRect().left + 25 : 50;
}
function drop() {
let dropPosition = 50;
if (widthRef.current >= 768) {
dropPosition = Math.round(100 / widthRef.current * lemonTopLeft);
} else {
dropPosition = Math.round(
((widthRef.current / 2 - 30) / widthRef.current) * 100,
);
}
waveTank.springs[dropPosition].p = -40;
}
useEffect(() => {
widthRef.current = width.value;
}, [width.value]);
useEffect(() => {
const mediaQuery = globalThis.matchMedia(
"(prefers-reduced-motion: reduce)",
);
if (mediaQuery.matches) {
return;
}
requestIdRef.current = requestAnimationFrame(update);
globalThis.addEventListener("resize", resize);
resize();
return () => {
globalThis.removeEventListener("resize", resize);
if (requestIdRef.current !== undefined) {
cancelAnimationFrame(requestIdRef.current);
}
};
}, []);
return (
<svg
width="100%"
height="100px"
viewBox="0 0 100 100"
preserveAspectRatio="none"
style="margin-top: -60px"
>
<polygon
points={springsPath}
fill="white"
transform="translate(0, 50)"
>
</polygon>
</svg>
);
}
export default LemonBottom;
+10 -10
View File
@@ -11,7 +11,7 @@ const waveTank = new WaveTank();
function LemonDrop() {
const SVG_WIDTH = 100;
const counter = useSignal(0);
const dropy = useSignal(60);
const dropY = useSignal(60);
const width = useSignal(SVG_WIDTH);
const widthRef = useRef(width.value);
const springs = useSignal(waveTank.springs);
@@ -37,10 +37,10 @@ function LemonDrop() {
const saw = x - Math.floor(x);
if (saw < 0.6) {
counter.value = easeInCirc(saw) * amp;
dropy.value = -100;
dropY.value = -100;
} else {
counter.value = easeInCirc(1 - saw) * amp * 0.1;
dropy.value = 70 + Math.pow(saw - 0.6, 2) * 10000;
dropY.value = 70 + Math.pow(saw - 0.6, 2) * 10000;
}
}
@@ -66,7 +66,7 @@ function LemonDrop() {
const dropPosition = Math.round(
((widthRef.current / 2 - 30) / widthRef.current) * 100,
);
waveTank.springs[dropPosition].p = -60;
waveTank.springs[dropPosition].p = -40;
}
useEffect(() => {
@@ -96,16 +96,16 @@ function LemonDrop() {
return (
<>
<svg
width="100"
height="300"
viewBox="0 0 100 300"
width="120"
height="240"
viewBox="0 0 100 180"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class="mt-32"
role="img"
aria-label="Fresh logo"
class="mt-8"
alt="Fresh logo"
>
<circle cx="18" cy={dropy.value} r="4" fill="white"></circle>
<circle cx="18" cy={dropY.value} r="4" fill="white"></circle>
<path
d="M11.9 96.3v24H7v-24h4.9Zm7.5 10.2v4h-8.8v-4h8.8Zm1-10.2v4h-9.8v-4h9.8ZM23.2 96.3H31c1.6 0 3 .3 4.1.9 1.1.5 2 1.3 2.6 2.4a8 8 0 0 1 1 4c0 1.3-.2 2.4-.6 3.3-.3 1-.8 1.7-1.5 2.3-.7.6-1.4 1-2.3 1.5l-1.5.8h-6.3v-4h4.3a3 3 0 0 0 1.7-.4c.4-.3.7-.7 1-1.2a5 5 0 0 0 .3-2c0-.7-.1-1.3-.3-1.9-.2-.5-.5-1-1-1.2-.3-.3-.9-.5-1.5-.5h-3v20h-4.8v-24Zm11 24-4.4-10.7h5l4.6 10.5v.2h-5.2ZM55.9 116.3v4H45.4v-4h10.5Zm-9-20v24H42v-24H47Zm7.6 9.8v3.8h-9.1v-3.8h9Zm1.4-9.8v4H45.4v-4h10.5ZM69 114c0-.4 0-.8-.2-1.1 0-.4-.2-.7-.5-1l-1-1-1.9-.8-2.6-1.2-2.2-1.5a6.5 6.5 0 0 1-1.7-2 6 6 0 0 1-.5-2.7c0-1 .1-2 .5-2.7a6 6 0 0 1 1.6-2.2c.7-.5 1.5-1 2.4-1.3a9.5 9.5 0 0 1 7.1.5c1.2.6 2 1.5 2.7 2.6.6 1 1 2.4 1 3.8h-5a5 5 0 0 0-.2-1.8c-.2-.5-.5-1-1-1.2-.4-.3-1-.5-1.6-.5-.6 0-1.1.2-1.5.4-.4.2-.7.6-1 1l-.2 1.4c0 .4.1.8.3 1.1l.8.8a21.3 21.3 0 0 0 2.8 1.4l2.9 1.4a9 9 0 0 1 2 1.8c.7.6 1 1.3 1.4 2a7.9 7.9 0 0 1-.1 5.5c-.4.8-.9 1.5-1.5 2.1a7 7 0 0 1-2.5 1.4c-2 .5-1 1.8-3 1.8s-1.3-1.5-3.2-1.8c-1-.3-2-.8-2.7-1.4a6.7 6.7 0 0 1-1.8-2.5c-.4-1-.6-2.2-.6-3.5h4.9c0 .7 0 1.3.2 1.8.1.5.3 1 .6 1.3.3.2.7.5 1.1.6.5.2 1 .2 1.5.2.7 0 1.2 0 1.6-.3.4-.3.6-.6.8-1 .2-.4.3-.9.3-1.4ZM90.5 106v4h-10v-4h10Zm-8.6-9.7v24h-4.8v-24h4.8Zm12.1 0v24h-4.8v-24H94Z"
fill="#0A140C"
+124
View File
@@ -0,0 +1,124 @@
import { useEffect, useRef } from "preact/hooks";
import { useSignal } from "@preact/signals";
import { WaveTank } from "../components/WaveTank.ts";
function easeInCirc(x: number) {
return 1 - Math.sqrt(1 - Math.pow(x, 2));
}
const waveTank = new WaveTank();
function LemonTop() {
const SVG_WIDTH = 100;
const counter = useSignal(0);
const dropY = useSignal(60);
const width = useSignal(SVG_WIDTH);
const widthRef = useRef(width.value);
const springs = useSignal(waveTank.springs);
const requestIdRef = useRef<number>();
const juice = `M18 ${63 + counter.value} C15 ${63 + counter.value} 16 ${
63 + counter.value
} 12 61L9 56C2 33 62 -3 80 12C103 27 44 56 29 58C27 58 25 59 24 61C20 ${
63 + counter.value
} 21 ${63 + counter.value} 18 ${63 + counter.value}Z`;
function updateJuice(timestamp: number) {
const amp = 40;
const x = timestamp / 2000;
const saw = x - Math.floor(x);
if (saw < 0.6) {
counter.value = easeInCirc(saw) * amp;
dropY.value = -100;
} else {
counter.value = easeInCirc(1 - saw) * amp * 0.1;
dropY.value = 70 + Math.pow(saw - 0.6, 2) * 10000;
}
}
function update(timestamp: number) {
updateJuice(timestamp);
waveTank.update(waveTank.springs);
springs.value = [...waveTank.springs];
const offset = 500;
const saw = (timestamp + offset) / 2000 -
Math.floor((timestamp + offset) / 2000);
if (saw < 0.01) {
drop();
}
requestIdRef.current = globalThis.requestAnimationFrame(update);
}
function resize() {
width.value = document.body.clientWidth;
}
function drop() {
const dropPosition = Math.round(
((widthRef.current / 2 - 30) / widthRef.current) * 100,
);
waveTank.springs[dropPosition].p = -40;
}
useEffect(() => {
widthRef.current = width.value;
}, [width.value]);
useEffect(() => {
const mediaQuery = globalThis.matchMedia(
"(prefers-reduced-motion: reduce)",
);
if (mediaQuery.matches) {
return;
}
requestIdRef.current = requestAnimationFrame(update);
globalThis.addEventListener("resize", resize);
resize();
return () => {
globalThis.removeEventListener("resize", resize);
if (requestIdRef.current !== undefined) {
cancelAnimationFrame(requestIdRef.current);
}
};
}, []);
return (
<>
<svg
width="150"
height="500"
viewBox="0 0 100 300"
fill="none"
xmlns="http://www.w3.org/2000/svg"
role="img"
class="mt-8 w-full h-auto max-w-32 lg:max-w-36"
alt="Fresh logo"
id="lemon-top"
>
<circle cx="18" cy={dropY.value} r="4" fill="#fff"></circle>
<path
d="M11.9 96.3v24H7v-24h4.9Zm7.5 10.2v4h-8.8v-4h8.8Zm1-10.2v4h-9.8v-4h9.8ZM23.2 96.3H31c1.6 0 3 .3 4.1.9 1.1.5 2 1.3 2.6 2.4a8 8 0 0 1 1 4c0 1.3-.2 2.4-.6 3.3-.3 1-.8 1.7-1.5 2.3-.7.6-1.4 1-2.3 1.5l-1.5.8h-6.3v-4h4.3a3 3 0 0 0 1.7-.4c.4-.3.7-.7 1-1.2a5 5 0 0 0 .3-2c0-.7-.1-1.3-.3-1.9-.2-.5-.5-1-1-1.2-.3-.3-.9-.5-1.5-.5h-3v20h-4.8v-24Zm11 24-4.4-10.7h5l4.6 10.5v.2h-5.2ZM55.9 116.3v4H45.4v-4h10.5Zm-9-20v24H42v-24H47Zm7.6 9.8v3.8h-9.1v-3.8h9Zm1.4-9.8v4H45.4v-4h10.5ZM69 114c0-.4 0-.8-.2-1.1 0-.4-.2-.7-.5-1l-1-1-1.9-.8-2.6-1.2-2.2-1.5a6.5 6.5 0 0 1-1.7-2 6 6 0 0 1-.5-2.7c0-1 .1-2 .5-2.7a6 6 0 0 1 1.6-2.2c.7-.5 1.5-1 2.4-1.3a9.5 9.5 0 0 1 7.1.5c1.2.6 2 1.5 2.7 2.6.6 1 1 2.4 1 3.8h-5a5 5 0 0 0-.2-1.8c-.2-.5-.5-1-1-1.2-.4-.3-1-.5-1.6-.5-.6 0-1.1.2-1.5.4-.4.2-.7.6-1 1l-.2 1.4c0 .4.1.8.3 1.1l.8.8a21.3 21.3 0 0 0 2.8 1.4l2.9 1.4a9 9 0 0 1 2 1.8c.7.6 1 1.3 1.4 2a7.9 7.9 0 0 1-.1 5.5c-.4.8-.9 1.5-1.5 2.1a7 7 0 0 1-2.5 1.4c-2 .5-1 1.8-3 1.8s-1.3-1.5-3.2-1.8c-1-.3-2-.8-2.7-1.4a6.7 6.7 0 0 1-1.8-2.5c-.4-1-.6-2.2-.6-3.5h4.9c0 .7 0 1.3.2 1.8.1.5.3 1 .6 1.3.3.2.7.5 1.1.6.5.2 1 .2 1.5.2.7 0 1.2 0 1.6-.3.4-.3.6-.6.8-1 .2-.4.3-.9.3-1.4ZM90.5 106v4h-10v-4h10Zm-8.6-9.7v24h-4.8v-24h4.8Zm12.1 0v24h-4.8v-24H94Z"
fill="#0A140C"
/>
<path
d="M84 16c13 27 1 52-7 59 0 4-9 9-12 7-12 5-38-2-53-21-6-7 1-21 21-36 13-10 33-17 51-9Z"
fill="#FFD80B"
/>
<path d={juice} fill="#fff" />
<path
d="M69 15c15-1 9 10-6 19L44 44c-2 1-4-2-6 0l-3 6c-3 1-13 3-16 2-5-2-5-9 5-18l7-4c-1-2-1-2 2-5 3-2 19-10 29-11l1 2 6-1Z"
fill="#FFED4E"
/>
<path
d="M38 35c1-1 3-2 3-4l8-3c0 1-1 3 1 4-2 1-7 1-8 5-1-2-1-2-4-2Z"
fill="#fff"
/>
</svg>
</>
);
}
export default LemonTop;
+7
View File
@@ -7,6 +7,13 @@ export default function App({ Component }: PageProps) {
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Fresh app</title>
<link
rel="preload"
href="/fonts/FixelVariable.woff2"
as="font"
type="font/woff2"
crossorigin="true"
/>
<link rel="stylesheet" href="/styles.css" />
</head>
<body>
-92
View File
@@ -1,92 +0,0 @@
import PageFooter from "../components/Footer.tsx";
import Header from "../components/Header.tsx";
import ComponentGallery from "../islands/ComponentGallery.tsx";
import { asset, Head } from "$fresh/runtime.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
function getSource(path: string) {
return Deno.readTextFile(new URL(path, import.meta.url));
}
export const handler: Handlers<HomeProps> = {
async GET(req, ctx) {
const props: HomeProps = {
sources: {
"Button": await getSource("../components/gallery/Button.tsx"),
"LinkButton": await getSource("../components/gallery/LinkButton.tsx"),
"ColoredButton": await getSource(
"../components/gallery/ColoredButton.tsx",
),
"Input": await getSource("../components/gallery/Input.tsx"),
"Header": await getSource("../components/gallery/Header.tsx"),
"Footer": await getSource("../components/gallery/Footer.tsx"),
"Hero": await getSource("../components/gallery/Hero.tsx"),
"Features": await getSource("../components/gallery/Features.tsx"),
"Carousel": await getSource("../components/gallery/Carousel.tsx"),
},
};
return ctx.render(props);
},
};
const TITLE = "Components | Fresh";
const DESCRIPTION = "A collection of components made for Fresh.";
interface HomeProps {
sources: Record<string, string>;
}
export default function Home(props: PageProps<HomeProps>) {
const ogImageUrl = new URL(asset("/home-og.png"), props.url).href;
return (
<div class="bg-white h-full">
<Head>
<title>{TITLE}</title>
<link
rel="stylesheet"
href="https://esm.sh/prismjs@1.29.0/themes/prism-dark.min.css"
/>
<meta name="description" content={DESCRIPTION} />
<meta property="og:title" content={TITLE} />
<meta property="og:description" content={DESCRIPTION} />
<meta property="og:type" content="website" />
<meta property="og:url" content={props.url.href} />
<meta property="og:image" content={ogImageUrl} />
<meta name="view-transition" content="same-origin" />
</Head>
<Header title="components" active="/components" />
<section class="my-16 px-4 sm:px-6 md:px-8 mx-auto max-w-screen-lg space-y-4">
<h2 class="text-3xl text-gray-600 font-bold">
Fresh Components
</h2>
<p class="text-gray-600">
A collection of components made for Fresh.
</p>
</section>
<div class="p-4 mx-auto max-w-screen-lg space-y-24 mb-16">
<ComponentGallery sources={props.data.sources} />
<a class="block" href="https://tabler-icons-tsx.deno.dev/">
<div
style="background-image: url(/gallery/banner-tabler-icons.png)"
class="h-48 bg-cover bg-no-repeat bg-white hover:opacity-50 hover:underline rounded"
>
<h2 class="text-4xl font-bold p-4">Icons</h2>
</div>
</a>
<a class="block" href="https://github.com/denoland/fresh_charts">
<div
style="background-image: url(/gallery/banner-chart.png)"
class="h-48 bg-cover bg-no-repeat bg-white hover:opacity-50 hover:underline rounded"
>
<h2 class="text-4xl font-bold p-4">Charts</h2>
</div>
</a>
</div>
<PageFooter />
</div>
);
}
+26 -192
View File
@@ -1,15 +1,17 @@
import { asset, Head } from "$fresh/runtime.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import Counter from "../islands/Counter.tsx";
import LemonDrop from "../islands/LemonDrop.tsx";
import Footer from "../components/Footer.tsx";
import VERSIONS from "../../versions.json" with { type: "json" };
import * as FeatureIcons from "../components/FeatureIcons.tsx";
import CopyArea from "../islands/CopyArea.tsx";
import * as Icons from "../components/Icons.tsx";
import Projects from "../components/Projects.tsx";
import projects from "../data/showcase.json" with { type: "json" };
import Header from "../components/Header.tsx";
import VERSIONS from "$fresh/versions.json" with { type: "json" };
import Footer from "$fresh/www/components/Footer.tsx";
import Header from "$fresh/www/components/Header.tsx";
import { CTA } from "$fresh/www/components/homepage/CTA.tsx";
import { Hero } from "$fresh/www/components/homepage/Hero.tsx";
import { IslandsSection } from "$fresh/www/components/homepage/IslandsSection.tsx";
import { PartialsSection } from "$fresh/www/components/homepage/PartialsSection.tsx";
import { RenderingSection } from "$fresh/www/components/homepage/RenderingSection.tsx";
import { FormsSection } from "../components/homepage/FormsSection.tsx";
import { Simple } from "$fresh/www/components/homepage/Simple.tsx";
import { SocialProof } from "$fresh/www/components/homepage/SocialProof.tsx";
import { DenoSection } from "$fresh/www/components/homepage/DenoSection.tsx";
function isOpenGraphUA(header: string | null): boolean {
if (!header) {
@@ -52,22 +54,26 @@ export default function MainPage(props: PageProps) {
<meta property="og:url" content={props.url.href} />
<meta property="og:image" content={ogImageUrl} />
<meta name="view-transition" content="same-origin" />
<link rel="stylesheet" href="/prism.css" />
</Head>
<div class="flex flex-col min-h-screen">
<div class="bg-green-300 flex flex-col">
<div class="bg-transparent flex flex-col relative z-10">
<HelloBar />
<Header title="" active="/" />
<Hero />
</div>
<div class="flex-1">
<Intro origin={origin} />
<Example />
<Showcase />
<StartJourney />
<div class="flex flex-col overflow-hidden -mt-20 relative">
<Hero origin={origin} />
<Simple />
<RenderingSection />
<IslandsSection />
<FormsSection />
<PartialsSection />
<SocialProof />
<DenoSection />
<CTA />
</div>
<Footer />
<Footer class="!mt-0" />
</div>
</>
);
@@ -76,7 +82,7 @@ export default function MainPage(props: PageProps) {
function HelloBar() {
return (
<a
class="bg-green-400 text-black border-b border-green-500 p-3 text-center group"
class="bg-gradient-to-r from-blue-200 to-yellow-200 via-green-300 text-black border-b border-green-400 p-4 text-center group"
href="https://deno.com/blog/fresh-1.6"
>
<b>Fresh v1.6</b> has been released with <b>Tailwind CSS</b>,{" "}
@@ -85,175 +91,3 @@ function HelloBar() {
</a>
);
}
function Hero() {
return (
<div
class="w-full flex justify-center items-center flex-col bg-green-300"
aria-hidden="true"
>
<LemonDrop />
</div>
);
}
function Features() {
const item = "flex items-center gap-5";
const desc = "flex-1";
return (
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 md:gap-14">
<div class={item}>
<FeatureIcons.Globe />
<div class={desc}>
<b>Just-in-time rendering</b> on the edge.
</div>
</div>
<div class={item}>
<FeatureIcons.Island />
<div class={desc}>
<b>Island based client hydration</b> for maximum interactivity.
</div>
</div>
<div class={item}>
<FeatureIcons.LightWeight />
<div class={desc}>
<b>Zero runtime overhead</b>: no JS is shipped to the client by
default.
</div>
</div>
<div class={item}>
<FeatureIcons.Garbage />
<div class={desc}>
<b>No configuration</b> necessary.
</div>
</div>
<div class={item}>
<FeatureIcons.TypeScript />
<div class={desc}>
<b>TypeScript support</b> out of the box.
</div>
</div>
</div>
);
}
function Intro(props: { origin: string }) {
return (
<section class="max-w-screen-xl mx-auto my-8 sm:my-16 px-4 sm:px-6 md:px-8 space-y-8 sm:space-y-16 lg:mb-32">
<div class="max-w-screen-xl mx-auto sm:my-8 md:my-16 sm:space-y-12 w-full">
<div class="md:flex items-center">
<div class="flex-1 text-center md:text-left">
<h2 class="py-2 text-5xl sm:text-5xl lg:text-6xl text-gray-900 sm:tracking-tight sm:leading-[1.1]! font-extrabold lg:max-w-lg mx-auto sm:mx-0">
The <span class="text-green-600">next-gen</span> web framework.
</h2>
<p class="mt-2 text-gray-600 text-xl">
Built for speed, reliability, and simplicity.
</p>
<div class="mt-8 flex flex-col justify-center md:justify-start sm:flex-row gap-4">
<div>
<a
href="/docs/getting-started"
class="inline-flex w-auto shrink-0 px-3 py-2 bg-white rounded border-gray-500 border-2 hover:bg-gray-200 active:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap"
>
Get started
</a>
</div>
<div class="flex justify-center">
<CopyArea code={`deno run -A -r ${props.origin}`} />
</div>
</div>
</div>
<picture class="block mt-8 md:mt-0 mx-auto w-60 md:w-96 md:mr-16 xl:mr-32">
<img
src="/illustration/lemon-squash.svg"
width={800}
height={678}
alt="Deno is drinking Fresh lemon squash"
/>
</picture>
</div>
</div>
<p class="text-gray-600 text-xl">
Fresh embraces the tried and true design of server side rendering and
progressive enhancement on the client side.
</p>
<Features />
</section>
);
}
function Example() {
return (
<section class="max-w-screen-xl mx-auto my-8 sm:my-16 md:my-24 px-4 sm:px-6 md:px-8 space-y-16">
<div class="flex gap-4 md:gap-16 flex-col md:flex-row justify-between items-center">
<div class="md:basis-1/2">
<h2 id="example" class="text-4xl text-gray-600 font-bold mb-4">
<a href="#example" class="hover:underline">
Interactive islands
</a>
</h2>
<p class="text-gray-600 mb-4">
Fresh optimizes the page by only shipping JavaScript for areas that
need it. The rest is completely static HTML rendered by the server.
This means the browser needs to load less code and can display pages
more quickly.
</p>
</div>
<div class="md:basis-1/2">
<Counter start={3} />
</div>
</div>
</section>
);
}
function Showcase() {
return (
<section class="max-w-screen-xl mx-auto px-4 sm:px-6 md:px-8 space-y-4">
<h2 id="showcase" class="text-4xl text-gray-600 font-bold mb-4">
<a href="#showcase" class="hover:underline">
Showcase
</a>
</h2>
<p class="text-gray-600">
Below is a selection of projects that have been built with Fresh.
</p>
<Projects items={projects.slice(0, 3)} class="gap-8" />
<div class="flex gap-2 items-center justify-center sm:justify-end text-blue-600">
<Icons.ArrowRight />
<a href="./showcase" class="hover:underline focus:underline">
View more
</a>
</div>
</section>
);
}
function StartJourney() {
return (
<section class="max-w-screen-xl mx-auto py-16 px-4 sm:px-6 md:px-8 space-y-4 md:mb-16">
<h2 class="text-4xl text-gray-600 md:text-5xl font mb-4 mt-0">
Start your Fresh journey
</h2>
<div class="flex flex-col md:flex-row justify-start items-center gap-4">
<p class="text-xl text-gray-600">
Jump right in and build your website with Fresh. Learn everything you
need to know in seconds.
</p>
<a
href="/docs/getting-started"
class="inline-block px-3 py-2 bg-white rounded border-gray-500 border-2 hover:bg-gray-200 active:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap"
>
Get started
</a>
</div>
</section>
);
}
+22
View File
@@ -0,0 +1,22 @@
import { PageProps } from "$fresh/server.ts";
import { Head } from "$fresh/runtime.ts";
import Header from "$fresh/www/components/Header.tsx";
export default function Layout({ Component, state }: PageProps) {
return (
<>
<Head>
<meta name="robots" content="noindex" />
</Head>
<Header active="" title="" />
<div class="w-full max-w-screen-xl px-4">
<Component />
<p class="mt-16">
This route is used only for demo purposes;{" "}
<a href="/" class="underline">see the home page</a>.
</p>
</div>
</>
);
}
+16
View File
@@ -0,0 +1,16 @@
import { Partial } from "$fresh/runtime.ts";
export const LemonHoneyTea = () => (
<Partial name="recipe">
<h2 class="mb-2 font-extrabold">Lemon-honey tea</h2>
<ul>
<li>1 cup boiling water</li>
<li>¼ tsp black tea</li>
<li>2 tsp honey</li>
<li>1 tsp lemon juice</li>
<li>Lemon peel</li>
</ul>
</Partial>
);
export default LemonHoneyTea;
+16
View File
@@ -0,0 +1,16 @@
import { Head, Partial } from "$fresh/runtime.ts";
export const Lemonade = () => (
<Partial name="recipe">
<h2 class="mb-2 font-extrabold">Lemonade</h2>
<ul>
<li>1 ¾ cups white sugar</li>
<li>1 cup water</li>
<li>9 lemons</li>
<li>7 cups ice water</li>
<li>Ice</li>
</ul>
</Partial>
);
export default Lemonade;
+17
View File
@@ -0,0 +1,17 @@
import { Partial } from "$fresh/runtime.ts";
export const LemonDrop = () => (
<Partial name="recipe">
<h2 class="mb-2 font-extrabold">Lemondrop Martini</h2>
<ul>
<li>2 oz vodka</li>
<li>3/4 oz triple sec</li>
<li>
1 oz fresh lemon juice
</li>
<li>3/4 oz simple syrup</li>
</ul>
</Partial>
);
export default LemonDrop;
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 137 291" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"><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:#000;stroke-width:18px;"/><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:#000;stroke-width:18px;"/></svg>

After

Width:  |  Height:  |  Size: 1016 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

+1
View File
@@ -0,0 +1 @@
<svg viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Deno Logo"><g clip-path="url(#clip0_29_599)"><path d="M15 0C23.2843 0 30 6.71572 30 15C30 23.2843 23.2843 30 15 30C6.71572 30 0 23.2843 0 15C0 6.71572 6.71572 0 15 0Z" fill="currentColor"></path><path d="M14.6635 22.3394C14.2788 22.2357 13.8831 22.4584 13.7705 22.8381L13.7655 22.8558L12.7694 26.5472L12.7649 26.565C12.6711 26.9498 12.9011 27.3414 13.2858 27.4451C13.6704 27.549 14.0661 27.3263 14.1787 26.9465L14.1837 26.9289L15.1797 23.2375L15.1843 23.2196C15.1911 23.1919 15.1962 23.164 15.1997 23.1362L15.2026 23.1084L15.179 22.9888L15.1445 22.8166L15.1227 22.7091C15.076 22.619 15.0111 22.5396 14.932 22.4759C14.853 22.4123 14.7615 22.3658 14.6635 22.3394ZM7.7224 18.5379C7.70424 18.5741 7.68883 18.6123 7.67658 18.6522L7.66967 18.6763L6.67358 22.3677L6.669 22.3856C6.57525 22.7704 6.80524 23.1619 7.1899 23.2657C7.57451 23.3695 7.97026 23.1469 8.08287 22.7671L8.08779 22.7494L8.99096 19.4023C8.51793 19.1518 8.09336 18.8628 7.7224 18.5379ZM5.34707 14.2929C4.9624 14.1891 4.56666 14.4117 4.4541 14.7915L4.44912 14.8092L3.45303 18.5006L3.44846 18.5184C3.35471 18.9032 3.58469 19.2947 3.96936 19.3985C4.35397 19.5023 4.74971 19.2797 4.86232 18.8999L4.86725 18.8822L5.86334 15.1908L5.86791 15.173C5.96166 14.7882 5.73174 14.3967 5.34707 14.2929ZM27.682 13.4546C27.2973 13.3508 26.9015 13.5734 26.789 13.9532L26.784 13.9709L25.7879 17.6623L25.7833 17.6801C25.6896 18.0649 25.9196 18.4564 26.3042 18.5602C26.6889 18.664 27.0846 18.4414 27.1972 18.0616L27.2021 18.0439L28.1982 14.3525L28.2028 14.3347C28.2965 13.9499 28.0666 13.5584 27.682 13.4546ZM3.17781 8.52527C2.34361 10.0444 1.81243 11.7112 1.61377 13.4329C1.7088 13.5412 1.83381 13.619 1.97301 13.6563C2.35768 13.7602 2.75342 13.5375 2.86598 13.1577L2.87096 13.1401L3.86705 9.44865L3.87162 9.43084C3.96537 9.04599 3.73539 8.65447 3.35072 8.5507C3.2943 8.53547 3.23623 8.52694 3.17781 8.52527ZM25.159 8.5507C24.7744 8.44687 24.3786 8.66953 24.266 9.04933L24.2611 9.06697L23.265 12.7584L23.2604 12.7762C23.1667 13.161 23.3966 13.5526 23.7813 13.6563C24.1659 13.7602 24.5617 13.5375 24.6743 13.1577L24.6792 13.1401L25.6753 9.44865L25.6799 9.43084C25.7736 9.04599 25.5436 8.65447 25.159 8.5507Z" fill="white"></path><path d="M7.51285 5.04065C7.12824 4.93682 6.73249 5.15948 6.61988 5.53929L6.61495 5.55692L5.61886 9.24833L5.61429 9.26614C5.52054 9.65098 5.75052 10.0425 6.13519 10.1463C6.5198 10.2501 6.91554 10.0274 7.02816 9.64764L7.03308 9.63001L8.02917 5.9386L8.03374 5.92079C8.12749 5.53595 7.89751 5.14442 7.51285 5.04065ZM20.3116 5.73845C19.9269 5.63462 19.5312 5.85727 19.4186 6.23708L19.4136 6.25471L18.7443 8.73499C19.1779 8.94915 19.5917 9.20126 19.9809 9.48839L20.0453 9.53643L20.8279 6.63639L20.8324 6.61858C20.9262 6.23374 20.6963 5.84221 20.3116 5.73845ZM13.7968 1.57642C13.3296 1.61771 12.8647 1.68338 12.4043 1.77317L12.3066 1.79263L11.3782 5.23419L11.3736 5.252C11.2799 5.63684 11.5099 6.02837 11.8945 6.13214C12.2792 6.23596 12.6749 6.01331 12.7875 5.6335L12.7924 5.61587L13.7885 1.92446L13.7931 1.90665C13.8196 1.79831 13.8209 1.68533 13.7968 1.57642ZM22.9626 4.1263L22.7669 4.85169L22.7623 4.86944C22.6686 5.25429 22.8986 5.64581 23.2832 5.74958C23.6678 5.85341 24.0636 5.63075 24.1762 5.25095L24.1811 5.23331L24.2025 5.15462C23.8362 4.81205 23.4511 4.49009 23.0491 4.19022L22.9626 4.1263ZM17.1672 1.69677L16.8139 3.00593L16.8094 3.02374C16.7156 3.40858 16.9456 3.80011 17.3303 3.90388C17.7149 4.0077 18.1106 3.78505 18.2233 3.40524L18.2282 3.38761L18.6 2.00966C18.1624 1.88867 17.719 1.79001 17.2714 1.71405L17.1672 1.69677Z" fill="white"></path><path d="M9.69085 24.6253C9.80341 24.2455 10.1992 24.0229 10.5838 24.1266C10.9685 24.2303 11.1984 24.6219 11.1047 25.0068L11.1001 25.0246L10.3872 27.6664L10.2876 27.6297C9.85836 27.4694 9.43765 27.2873 9.0271 27.0839L9.68587 24.6429L9.69085 24.6253Z" fill="white"></path><path d="M14.4141 8.49082C10.0522 8.49082 6.65918 11.2368 6.65918 14.6517C6.65918 17.8769 9.78123 19.9362 14.6211 19.8331C15.0327 19.8243 15.1517 20.1008 15.2856 20.4734C15.4196 20.846 15.7796 22.8097 16.0665 24.3117C16.3233 25.656 16.5842 27.0052 16.7834 28.3596C19.9439 27.9418 22.8663 26.3807 25.0076 24.0261L22.7237 15.5088C22.1544 13.4518 21.489 11.5564 19.7283 10.1794C18.3118 9.07166 16.5122 8.49082 14.4141 8.49082Z" fill="white"></path><path d="M15.3516 10.957C15.8694 10.957 16.2891 11.3767 16.2891 11.8945C16.2891 12.4123 15.8694 12.832 15.3516 12.832C14.8338 12.832 14.4141 12.4123 14.4141 11.8945C14.4141 11.3767 14.8338 10.957 15.3516 10.957Z" fill="currentColor"></path></g><defs><clipPath id="clip0_29_599"><rect width="30" height="30" fill="white"></rect></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

+1
View File
@@ -0,0 +1 @@
<svg width="2162" height="2500" viewBox="0 0 256 296" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path fill="#673AB8" d="M128 0l128 73.9v147.8l-128 73.9L0 221.7V73.9z"/><path d="M34.865 220.478c17.016 21.78 71.095 5.185 122.15-34.704 51.055-39.888 80.24-88.345 63.224-110.126-17.017-21.78-71.095-5.184-122.15 34.704-51.055 39.89-80.24 88.346-63.224 110.126zm7.27-5.68c-5.644-7.222-3.178-21.402 7.573-39.253 11.322-18.797 30.541-39.548 54.06-57.923 23.52-18.375 48.303-32.004 69.281-38.442 19.922-6.113 34.277-5.075 39.92 2.148 5.644 7.223 3.178 21.403-7.573 39.254-11.322 18.797-30.541 39.547-54.06 57.923-23.52 18.375-48.304 32.004-69.281 38.441-19.922 6.114-34.277 5.076-39.92-2.147z" fill="#FFF"/><path d="M220.239 220.478c17.017-21.78-12.169-70.237-63.224-110.126C105.96 70.464 51.88 53.868 34.865 75.648c-17.017 21.78 12.169 70.238 63.224 110.126 51.055 39.889 105.133 56.485 122.15 34.704zm-7.27-5.68c-5.643 7.224-19.998 8.262-39.92 2.148-20.978-6.437-45.761-20.066-69.28-38.441-23.52-18.376-42.74-39.126-54.06-57.923-10.752-17.851-13.218-32.03-7.575-39.254 5.644-7.223 19.999-8.261 39.92-2.148 20.978 6.438 45.762 20.067 69.281 38.442 23.52 18.375 42.739 39.126 54.06 57.923 10.752 17.85 13.218 32.03 7.574 39.254z" fill="#FFF"/><path d="M127.552 167.667c10.827 0 19.603-8.777 19.603-19.604 0-10.826-8.776-19.603-19.603-19.603-10.827 0-19.604 8.777-19.604 19.603 0 10.827 8.777 19.604 19.604 19.604z" fill="#FFF"/></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

+1
View File
@@ -0,0 +1 @@
<svg fill="none" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><rect fill="#3178c6" height="512" rx="50" width="512"/><rect fill="#3178c6" height="512" rx="50" width="512"/><path clip-rule="evenodd" d="m316.939 407.424v50.061c8.138 4.172 17.763 7.3 28.875 9.386s22.823 3.129 35.135 3.129c11.999 0 23.397-1.147 34.196-3.442 10.799-2.294 20.268-6.075 28.406-11.342 8.138-5.266 14.581-12.15 19.328-20.65s7.121-19.007 7.121-31.522c0-9.074-1.356-17.026-4.069-23.857s-6.625-12.906-11.738-18.225c-5.112-5.319-11.242-10.091-18.389-14.315s-15.207-8.213-24.18-11.967c-6.573-2.712-12.468-5.345-17.685-7.9-5.217-2.556-9.651-5.163-13.303-7.822-3.652-2.66-6.469-5.476-8.451-8.448-1.982-2.973-2.974-6.336-2.974-10.091 0-3.441.887-6.544 2.661-9.308s4.278-5.136 7.512-7.118c3.235-1.981 7.199-3.52 11.894-4.615 4.696-1.095 9.912-1.642 15.651-1.642 4.173 0 8.581.313 13.224.938 4.643.626 9.312 1.591 14.008 2.894 4.695 1.304 9.259 2.947 13.694 4.928 4.434 1.982 8.529 4.276 12.285 6.884v-46.776c-7.616-2.92-15.937-5.084-24.962-6.492s-19.381-2.112-31.066-2.112c-11.895 0-23.163 1.278-33.805 3.833s-20.006 6.544-28.093 11.967c-8.086 5.424-14.476 12.333-19.171 20.729-4.695 8.395-7.043 18.433-7.043 30.114 0 14.914 4.304 27.638 12.912 38.172 8.607 10.533 21.675 19.45 39.204 26.751 6.886 2.816 13.303 5.579 19.25 8.291s11.086 5.528 15.415 8.448c4.33 2.92 7.747 6.101 10.252 9.543 2.504 3.441 3.756 7.352 3.756 11.733 0 3.233-.783 6.231-2.348 8.995s-3.939 5.162-7.121 7.196-7.147 3.624-11.894 4.771c-4.748 1.148-10.303 1.721-16.668 1.721-10.851 0-21.597-1.903-32.24-5.71-10.642-3.806-20.502-9.516-29.579-17.13zm-84.159-123.342h64.22v-41.082h-179v41.082h63.906v182.918h50.874z" fill="#fff" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+4 -5
View File
@@ -28,9 +28,8 @@
.markdown-body {
word-wrap: break-word;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica,
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
font-size: 16px;
font-family: inherit;
font-size: 1.125rem;
line-height: 1.75;
}
.markdown-body:before {
@@ -429,7 +428,7 @@
text-align: left;
white-space: nowrap;
padding: 5px;
font-size: 12px;
font-size: 0.75rem;
line-height: 1;
overflow: hidden;
}
@@ -456,7 +455,7 @@
.markdown-body .footnotes {
color: var(--color-fg-muted);
border-top: 1px solid var(--color-border-default);
font-size: 12px;
font-size: 0.75rem;
}
.markdown-body .footnotes ol {
padding-left: 16px;
+3
View File
@@ -0,0 +1,3 @@
/* PrismJS 1.29.0
https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript */
code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#272822}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8292a2}.token.punctuation{color:#f8f8f2}.token.namespace{opacity:.7}.token.constant,.token.deleted,.token.property,.token.symbol,.token.tag{color:#f92672}.token.boolean,.token.number{color:#ae81ff}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#a6e22e}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.class-name,.token.function{color:#e6db74}.token.keyword{color:#66d9ef}.token.important,.token.regex{color:#fd971f}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

+37
View File
@@ -1,3 +1,40 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@font-face {
font-family: Fixel;
font-style: normal;
src: url("/fonts/FixelVariable.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
@font-face {
font-family: Fixel;
font-style: italic;
src: url("/fonts/FixelVariableItalic.woff2") format("woff2");
font-weight: 100 900;
font-display: swap;
}
body {
font-family: Fixel, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
font-weight: 450;
font-size: 1.125rem;
line-height: 1.5;
color: #333;
}
b,
strong,
.font-bold,
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 750;
}
+8
View File
@@ -18,4 +18,12 @@ export default {
});
}),
],
theme: {
extend: {
colors: {
fresh: "#FFDB1E",
"fresh-dark": "#401C00",
},
},
},
} satisfies Config;
+1 -1
View File
@@ -1,3 +1,4 @@
import Prism from "https://esm.sh/prismjs@1.29.0";
import "https://esm.sh/prismjs@1.29.0/components/prism-jsx.js?no-check";
import "https://esm.sh/prismjs@1.29.0/components/prism-typescript.js?no-check";
import "https://esm.sh/prismjs@1.29.0/components/prism-tsx.js?no-check";
@@ -8,7 +9,6 @@ import "https://esm.sh/prismjs@1.29.0/components/prism-yaml.js?no-check";
export { extract as frontMatter } from "$std/front_matter/yaml.ts";
import Prism from "https://esm.sh/prismjs@1.29.0";
import * as Marked from "https://esm.sh/marked@7.0.2";
import { escape as escapeHtml } from "$std/html/entities.ts";
import { mangle } from "$marked-mangle";