From 645e815ebe11dbb86781c3eb645d3d67cd62cf7c Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Fri, 27 Jun 2025 16:34:09 +0700
Subject: nice nice. lsp still doesnt work tho

---
 lib/pages/BlogIndex.mlx | 76 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 lib/pages/BlogIndex.mlx

(limited to 'lib/pages/BlogIndex.mlx')

diff --git a/lib/pages/BlogIndex.mlx b/lib/pages/BlogIndex.mlx
new file mode 100644
index 0000000..3e036aa
--- /dev/null
+++ b/lib/pages/BlogIndex.mlx
@@ -0,0 +1,76 @@
+open Shared
+
+let header ~title () = <header><h1>title</h1></header>
+
+let page =
+  <html>
+    <body>
+      <header title="Hello, world!" /> <div>(React.string "Some content goes here")</div>
+    </body>
+  </html>
+;;
+
+module Layout = struct
+  let[@react.component] make ~children =
+    <html>
+      <head>
+        <title>(React.string "Bloody Shovel 5")</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+        <meta charSet="UTF-8" />
+      </head>
+      <body>children</body>
+    </html>
+  ;;
+end
+
+module PostPreviews = struct
+  let[@react.component] make ~(conn : Query.conn) =
+    let posts =
+      match Query.get_poasts () conn with
+      | Error _err -> []
+      | Ok posts -> posts
+    in
+    let tests = "This is 'a 'weird <thingy>" in
+    <div>
+      (match posts with
+       | [] -> React.string "No posts"
+       | posts ->
+         let ps =
+           posts
+           |> List.map (fun (p : Query.post_summary) ->
+             Logs.info (fun d -> d "poast %s\n" p.title);
+             <h1>(React.string p.title)</h1>)
+         in
+         let pp = React.string tests :: ps in
+         pp |> Array.of_list |> React.array)
+    </div>
+  ;;
+end
+
+let[@react.component] make (conn : Query.conn) =
+  <Layout>
+    <div className="min-h-screen bg-gray-50">
+      <Navbar />
+      <main className="container mx-auto px-4 py-8">
+        <SiteTitle />
+        <div className="max-w-4xl mx-auto space-y-12"><PostPreviews conn /></div>
+      </main>
+    </div>
+  </Layout>
+;;
+
+(* let[@react.component] make (conn : Query.conn) = *)
+(* let posts = *)
+(* match Query.get_poasts () conn with *)
+(* | Error _err -> [] *)
+(* | Ok posts -> posts *)
+(* in *)
+(* <div> *)
+(* (match posts with *)
+(* | [] -> React.string "No posts" *)
+(* | hd :: _tl -> React.string hd.title) *)
+(* </div> *)
+(* ;; *)
+
+(* # formatter = {command = "ocamlformat-mlx", args = ["-", "--impl"]} *)
+(*  List.map (fun _p -> <p>(React.string "wtf")</p>) posts |> React.list *)
-- 
cgit v1.2.3

