feat: better index css

This commit is contained in:
monoid 2023-10-26 22:11:26 +09:00
parent e6d7020fc8
commit fae9cc8154
1 changed files with 15 additions and 17 deletions

View File

@ -1,25 +1,21 @@
import { Head } from "$fresh/runtime.ts"; import { Head } from "$fresh/runtime.ts";
import { useSignal } from "@preact/signals"; import { get_pages_meta, PageDescription } from "../pages.ts";
import {Button} from "../components/Button.tsx";
import { PageDescription, get_pages_meta } from "../pages.ts";
import { Handlers, PageProps } from "$fresh/server.ts"; import { Handlers, PageProps } from "$fresh/server.ts";
export const handler: Handlers = { export const handler: Handlers = {
async GET(_req, ctx){ async GET(_req, ctx) {
const [pages,_] = await get_pages_meta(); const [pages, _] = await get_pages_meta();
return await ctx.render(pages); return await ctx.render(pages);
} },
} };
export default function Home({data}: PageProps<PageDescription[]>) { export default function Home({ data }: PageProps<PageDescription[]>) {
const count = useSignal(3);
return ( return (
<> <>
<Head> <Head>
<title>stock-front</title> <title>stock-front</title>
</Head> </Head>
<div class="px-4 py-8 mx-auto bg-[#86efac]"> <div class="px-4 py-8 mx-auto bg-[#86efac] min-h-screen">
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center"> <div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
<img <img
class="my-6" class="my-6"
@ -31,14 +27,16 @@ export default function Home({data}: PageProps<PageDescription[]>) {
<h1 class="text-4xl font-bold">Stock</h1> <h1 class="text-4xl font-bold">Stock</h1>
<div class="my-4"> <div class="my-4">
<ul> <ul>
{ {data.map((x) => (
data.map(x=><li class="my-2"> <li class="my-2">
<a class="p-2 block hover:bg-gray-300 bg-white rounded" href={`/pages/${encodeURIComponent(x.name)}`}> <a
class="p-2 block hover:bg-gray-300 bg-white rounded"
href={`/pages/${encodeURIComponent(x.name)}`}
>
{x.name} {x.name}
</a> </a>
</li> </li>
) ))}
}
</ul> </ul>
</div> </div>
</div> </div>