| 1 | import { Schema as S } from "effect"; |
| 2 | import type { Runtime, Update } from "foldkit"; |
| 3 | import type { Document, HtmlBuilder } from "foldkit/html"; |
| 4 | |
| 5 | import { card } from "./components/Card.ts"; |
| 6 | |
| 7 | // MODEL |
| 8 | |
| 9 | export const Model = S.Struct({}); |
| 10 | export type Model = typeof Model.Type; |
| 11 | |
| 12 | // MESSAGE |
| 13 | |
| 14 | // The page is static — nothing dispatches, so the app has no messages. |
| 15 | export type Message = never; |
| 16 | |
| 17 | // UPDATE |
| 18 | |
| 19 | export const update = ( |
| 20 | model: Model, |
| 21 | _message: Message, |
| 22 | ): Update.Return<Model, Message> => ({ model }); |
| 23 | |
| 24 | // INIT |
| 25 | |
| 26 | export const init: Runtime.ApplicationInit<Model, Message> = () => ({ |
| 27 | model: {}, |
| 28 | }); |
| 29 | |
| 30 | // VIEW |
| 31 | |
| 32 | export const view = (_model: Model, h: HtmlBuilder<Message>): Document => ({ |
| 33 | title: "Foldkit", |
| 34 | body: h.div( |
| 35 | [h.Id("app")], |
| 36 | [ |
| 37 | h.h1([h.Class("text-3xl font-bold")], ["Hello from Foldkit!"]), |
| 38 | card(h, { |
| 39 | title: "Styled with Tailwind CSS", |
| 40 | body: "This card is a Foldkit view function styled with Tailwind utilities.", |
| 41 | }), |
| 42 | ], |
| 43 | ), |
| 44 | }); |