56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { FreshContext, Handlers, PageProps } from "$fresh/server.ts";
|
|
import { ProjectCard } from "../../islands/ProjectCard.tsx";
|
|
|
|
interface ProjectData {
|
|
project_id: number;
|
|
title: string;
|
|
repo?: string;
|
|
summary: string;
|
|
tech: string;
|
|
wip?: boolean;
|
|
created_at: string;
|
|
}
|
|
|
|
export const handler: Handlers<ProjectData> = {
|
|
async GET(_req: Request, ctx: FreshContext) {
|
|
const projectResult = await fetch(
|
|
`${Deno.env.get("BASE_URI_API")}/projects`,
|
|
);
|
|
|
|
const projectData = await projectResult.json();
|
|
return ctx.render({
|
|
projectData,
|
|
});
|
|
},
|
|
};
|
|
|
|
export default function Projects({ data }: PageProps<ProjectData>) {
|
|
const { projectData: projects } = data;
|
|
|
|
return (
|
|
<div class="space-y-12 px-10 py-8 sm:min-h-screen bg-[#313244]">
|
|
<section
|
|
id="projects"
|
|
class="lg:grid-cols-desktop grid scroll-mt-16 grid-cols-1 gap-x-10 gap-y-4 bg-[#313244] "
|
|
>
|
|
<h1 class="text-3xl text-white font-bold uppercase text-center">
|
|
Projects
|
|
</h1>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2">
|
|
{projects.map((project: any) => {
|
|
return (
|
|
<ProjectCard
|
|
title={project.title}
|
|
repo={project.repo ?? undefined}
|
|
summary={project.summary}
|
|
tech={project.tech}
|
|
wip={project.wip ?? true}
|
|
/>
|
|
);
|
|
})}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
);
|
|
}
|