reset to remix
This commit is contained in:
commit
789cb7bdfb
22 changed files with 23521 additions and 0 deletions
35
app/routes/index.tsx
Normal file
35
app/routes/index.tsx
Normal file
|
@ -0,0 +1,35 @@
|
|||
import { CardBase, CardHeader } from "~/components/Card";
|
||||
import { HiChevronRight } from "react-icons/hi2";
|
||||
import type { IndexResponse, World } from "~/utils/saerro";
|
||||
import { indexQuery } from "~/utils/saerro";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import { json } from "@remix-run/cloudflare";
|
||||
|
||||
export const loader = async () => {
|
||||
return json(await indexQuery());
|
||||
};
|
||||
|
||||
export default function Index() {
|
||||
const { allWorlds } = useLoaderData<typeof loader>();
|
||||
|
||||
return (
|
||||
<div>
|
||||
{allWorlds.map((world) => (
|
||||
<WorldCard key={world.id} world={world} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const WorldCard = ({ world }: { world: World }) => {
|
||||
return (
|
||||
<CardBase>
|
||||
<CardHeader to={`/worlds/${world.id}`}>
|
||||
<div>{world.name}</div>
|
||||
<div>
|
||||
<HiChevronRight />
|
||||
</div>
|
||||
</CardHeader>
|
||||
</CardBase>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue