2023-07-23 00:32:54 +09:00
|
|
|
import { Head } from "$fresh/runtime.ts";
|
2023-10-26 22:11:26 +09:00
|
|
|
import { get_pages_meta, PageDescription } from "../pages.ts";
|
2023-07-23 00:32:54 +09:00
|
|
|
import { Handlers, PageProps } from "$fresh/server.ts";
|
|
|
|
|
|
|
|
export const handler: Handlers = {
|
2023-10-26 22:11:26 +09:00
|
|
|
async GET(_req, ctx) {
|
|
|
|
const [pages, _] = await get_pages_meta();
|
2023-07-23 00:32:54 +09:00
|
|
|
return await ctx.render(pages);
|
2023-10-26 22:11:26 +09:00
|
|
|
},
|
|
|
|
};
|
2023-07-23 00:32:54 +09:00
|
|
|
|
2023-10-26 22:11:26 +09:00
|
|
|
export default function Home({ data }: PageProps<PageDescription[]>) {
|
2023-07-23 00:32:54 +09:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Head>
|
|
|
|
<title>stock-front</title>
|
|
|
|
</Head>
|
2023-10-26 22:11:26 +09:00
|
|
|
<div class="px-4 py-8 mx-auto bg-[#86efac] min-h-screen">
|
2023-07-23 00:32:54 +09:00
|
|
|
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
|
|
|
|
<img
|
|
|
|
class="my-6"
|
|
|
|
src="/logo.svg"
|
|
|
|
width="128"
|
|
|
|
height="128"
|
|
|
|
alt="the fresh logo: a sliced lemon dripping with juice"
|
|
|
|
/>
|
|
|
|
<h1 class="text-4xl font-bold">Stock</h1>
|
|
|
|
<div class="my-4">
|
|
|
|
<ul>
|
2023-10-26 22:11:26 +09:00
|
|
|
{data.map((x) => (
|
|
|
|
<li class="my-2">
|
|
|
|
<a
|
|
|
|
class="p-2 block hover:bg-gray-300 bg-white rounded"
|
|
|
|
href={`/pages/${encodeURIComponent(x.name)}`}
|
|
|
|
>
|
2023-07-23 00:32:54 +09:00
|
|
|
{x.name}
|
|
|
|
</a>
|
2023-10-26 22:11:26 +09:00
|
|
|
</li>
|
|
|
|
))}
|
2023-07-23 00:32:54 +09:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|