www: new landing page (#602)

* design: add icons to features

* www: update intro layout

* www: add copy button

* www: create CopyArea island

* www: update info style

* www: add showcase

* Update www/routes/index.tsx

Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>

* www: set text-center to feature descriptions

* www: remove showcase image tabindex

add hover feedback to the showcase tiles

* www: add deno install / update links

* www: left align the feature descriptions on small screens

* www: fix broken getting started layout on mobile

* www: always show the copy buttons

* www: add some additional vertical spacing

* improve screenshots

Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
hashrock
2022-08-10 14:50:29 +09:00
committed by GitHub
co-authored by Luca Casonato Luca Casonato
parent 7b0c190454
commit c7cbd23052
14 changed files with 609 additions and 72 deletions
+178 -67
View File
@@ -1,13 +1,23 @@
/** @jsx h */
/** @jsxFrag Fragment */
import { ComponentChildren, Fragment, h } from "preact";
import { Fragment, h } from "preact";
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 { Leaf } from "../components/Icons.tsx";
import VERSIONS from "../../versions.json" assert { 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 "../data/showcase.json" assert { type: "json" };
interface Project {
image: string;
title: string;
link: string;
github?: string;
}
export const handler: Handlers = {
GET(req, ctx) {
@@ -48,6 +58,7 @@ export default function MainPage(props: PageProps) {
<Intro />
<GettingStarted origin={origin} />
<Example />
<Showcase items={projects} />
</div>
<Footer />
</div>
@@ -72,16 +83,54 @@ function Hero() {
</Fragment>
);
}
export interface ListItemProps {
children: ComponentChildren;
}
function ListItem(props: ListItemProps) {
function Features() {
const item = "flex md:flex-col items-center gap-5";
const desc = "flex-1 md:text-center";
return (
<div class="flex mt-3">
<Leaf />
<div class="pl-4 flex-1">
{props.children}
<div class="grid md: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.NoBuild />
<div class={desc}>
<b>No build step</b>.
</div>
</div>
<div class={item}>
<FeatureIcons.Gabage />
<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>
);
@@ -89,48 +138,31 @@ function ListItem(props: ListItemProps) {
function Intro() {
return (
<section class="max-w-screen-sm mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<picture>
<img
src="/illustration/lemon-squash.svg"
class="w-64 mx-auto"
width={800}
height={678}
alt="deno is drinking fresh lemon squash"
/>
</picture>
<section class="max-w-screen-md mx-auto my-16 px(4 sm:6 md:8) space-y-12">
<div class="md:flex items-center">
<div class="flex-1 text-center md:text-left">
<h2 class="py-2 text(5xl sm:5xl lg:5xl gray-900) sm:tracking-tight sm:leading-[1.1]! font-extrabold">
The <span class="text-green-500">next-gen</span> web framework.
</h2>
<h2 class="py-4 text(4xl sm:4xl lg:4xl gray-900 center) sm:tracking-tight font-extrabold">
The next-gen web framework.
</h2>
<p class="mt-4 text-gray-600">
Built for speed, reliability, and simplicity.
</p>
</div>
<p class="text-gray-600">
Fresh is a next generation web framework, built for speed, reliability,
and simplicity. Some stand out features:
</p>
<div>
<ListItem>
<b>Just-in-time rendering</b> on the edge.
</ListItem>
<ListItem>
<b>Island based client hydration</b> for maximum interactivity.
</ListItem>
<ListItem>
<b>Zero runtime overhead</b>: no JS is shipped to the client by
default.
</ListItem>
<ListItem>
<b>No build step</b>.
</ListItem>
<ListItem>
<b>No configuration</b> necessary.
</ListItem>
<ListItem>
<b>TypeScript support</b> out of the box.
</ListItem>
<picture class="block mt-4 md:mt-0">
<img
src="/illustration/lemon-squash.svg"
class="w-80 mx-auto"
width={800}
height={678}
alt="deno is drinking fresh lemon squash"
/>
</picture>
</div>
<Features />
<p class="text-gray-600">
Fresh embraces the tried and true design of server side rendering and
progressive enhancement on the client side.
@@ -141,32 +173,51 @@ function Intro() {
function GettingStarted(props: { origin: string }) {
return (
<section class="max-w-screen-sm mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<h2 id="getting-started" class="text(xl gray-600) font-bold">
<section class="max-w-screen-md mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<h2 id="getting-started" class="text(3xl gray-600) font-bold">
<a href="#getting-started" class="hover:underline">
Getting started
Getting Started
</a>
</h2>
<div class="text-gray-600 flex gap-1 mb-4 bg-gray-100 p-2 rounded">
<div class="text-gray-400">
<Icons.Info />
</div>
<p>
<a href="https://deno.land" class="text-blue-600 hover:underline">
Deno CLI
</a>{" "}
version 1.23.0 or higher is required.{" "}
<a
href="https://deno.land/manual/getting_started/installation"
class="text-blue-600 hover:underline"
>
Install
</a>{" "}
or{" "}
<a
href="https://deno.land/manual/getting_started/installation#updating"
class="text-blue-600 hover:underline"
>
update
</a>.
</p>
</div>
<p class="text-gray-600">
To get started, make sure you have the{" "}
<a href="https://deno.land" class="text-blue-600 hover:underline">
Deno CLI
</a>{" "}
version 1.23.0 or higher installed.
To bootstrap a new project:
</p>
<p class="text-gray-600">
Then you can use the Fresh init script to bootstrap a new project:
</p>
<pre class="overflow-x-auto py-2 px-4 bg(gray-100)">
<CopyArea>
{`deno run -A -r ${props.origin} my-project`}
</pre>
</CopyArea>
<p class="text-gray-600">
Enter the newly created project directory and run the following command
to start the development server:
</p>
<pre class="overflow-x-auto py-2 px-4 bg(gray-100)">
deno task start
</pre>
<CopyArea>{`deno task start`}</CopyArea>
<p class="text-gray-600">
You can now open{" "}
<a
@@ -178,7 +229,14 @@ function GettingStarted(props: { origin: string }) {
in your browser to view the page.
</p>
<p class="text-gray-600">
A more in-depth getting started guide is available in{" "}
A more in-depth{" "}
<a
href="/docs/getting-started"
class="text-blue-600 hover:underline"
>
<i>Getting Started</i>
</a>{" "}
guide is available in{" "}
<a href="/docs" class="text-blue-600 hover:underline">the docs</a>.
</p>
</section>
@@ -192,8 +250,8 @@ const timeFmt = new Intl.DateTimeFormat("en-US", {
function Example() {
return (
<section class="max-w-screen-sm mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<h2 id="example" class="text(xl gray-600) font-bold">
<section class="max-w-screen-md mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<h2 id="example" class="text(3xl gray-600) font-bold">
<a href="#example" class="hover:underline">
Example
</a>
@@ -215,3 +273,56 @@ function Example() {
</section>
);
}
function Showcase({ items }: { items: Project[] }) {
return (
<section class="max-w-screen-md mx-auto my-16 px(4 sm:6 md:8) space-y-4">
<h2 id="showcase" class="text(3xl gray-600) font-bold">
<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.{" "}
<a
href="https://github.com/denoland/fresh/blob/main/www/data/showcase.json"
class="text-blue-600 hover:underline"
>
Add yours!
</a>
</p>
<div class="pt-8 gap-20 md:gap-4 flex-col md:flex-row flex justify-between items-center">
{items.map((project) => (
<div class="w-full max-w-sm group">
<a href={project.link} tabIndex={-1}>
<img
loading="lazy"
src={`/showcase/${project.image}1x.jpg`}
srcset={`/showcase/${project.image}2x.jpg 2x, /showcase/${project.image}1x.jpg 1x`}
alt={project.title}
width={600}
height={337}
style={{ aspectRatio: "16/9" }}
class="object-cover shadow-lg group-hover:(shadow-xl opacity-70) rounded-lg"
/>
</a>
<div class="mt-4 flex items-center">
<div class="text(lg gray-600) flex-1 group-hover:text-underline">
<a href={project.link}>{project.title}</a>
</div>
{project.github && (
<a
href={`https://github.com/${project.github}`}
class="ml-2 text-gray-500 hover:text-gray-700"
>
<span class="sr-only">GitHub</span>
<Icons.GitHub class="inline float-right" />
</a>
)}
</div>
</div>
))}
</div>
</section>
);
}