www: add showcase page (#699)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
hashrock
2022-09-06 15:28:20 +02:00
committed by GitHub
co-authored by Luca Casonato
parent 28ae07da35
commit 8e9658cae5
10 changed files with 292 additions and 123 deletions
+10 -47
View File
@@ -7,15 +7,9 @@ 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 "../components/Projects.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) {
const accept = req.headers.get("accept");
@@ -55,7 +49,7 @@ export default function MainPage(props: PageProps) {
<Intro />
<GettingStarted origin={origin} />
<Example />
<Showcase items={projects} />
<Showcase />
</div>
<Footer />
</div>
@@ -271,7 +265,7 @@ function Example() {
);
}
function Showcase({ items }: { items: Project[] }) {
function Showcase() {
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">
@@ -280,45 +274,14 @@ function Showcase({ items }: { items: Project[] }) {
</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>
Below is a selection of projects that have been built with Fresh.
</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>
))}
<Projects items={projects.slice(0, 3)} class="gap-8" />
<div class="flex gap-2 items-center justify-end text-blue-600">
<Icons.ArrowRight />
<a href="./showcase" class="hover:underline focus:underline">
View more
</a>
</div>
</section>
);