summaryrefslogtreecommitdiff
path: root/lib/views/layouts.ml
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-01-25 19:16:32 +0100
committerMarius Peter <marius.peter@tutanota.com>2025-01-25 19:16:32 +0100
commit4edccf9a2504e8798df160e04a0820a7256f82b1 (patch)
tree371db4e0dbeaf8a62f1b2adb5b7f445b6bb799a0 /lib/views/layouts.ml
parentd817e1e464d1fb0c251c0d5e97b15466b0b1621c (diff)
Restructure Views library.
Diffstat (limited to 'lib/views/layouts.ml')
-rw-r--r--lib/views/layouts.ml45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/views/layouts.ml b/lib/views/layouts.ml
new file mode 100644
index 0000000..d9def3c
--- /dev/null
+++ b/lib/views/layouts.ml
@@ -0,0 +1,45 @@
+open Dream_html
+open HTML
+
+let header =
+ div []
+ [
+ h1 [] [ txt "ogit" ];
+ h2 [] [ txt "A mobile-friendly Git repository viewer" ];
+ ]
+
+let topnav =
+ nav
+ [ id "top" ]
+ [
+ ul []
+ [
+ li [] [ a [ href "/" ] [ txt "Home" ] ];
+ li [] [ a [ href "/" ] [ txt "Refs" ] ];
+ li [] [ a [ href "/" ] [ txt "Log" ] ];
+ li [] [ a [ href "/" ] [ txt "Tree" ] ];
+ li [] [ a [ href "/" ] [ txt "Commit" ] ];
+ li [] [ a [ href "/" ] [ txt "Diff" ] ];
+ ];
+ ]
+
+let footer name =
+ let today = Unix.localtime (Unix.time ()) in
+ let year = string_of_int (today.Unix.tm_year + 1900) in
+ let space = " " in
+ let footer_text = String.concat space [ "©"; year; name ] in
+ footer [] [ txt "%s" footer_text ]
+
+let application ?(page_title = "ogit") ?(head_content = null []) ~main_content
+ () =
+ html []
+ [
+ head [] [ title [] "%s" page_title; head_content ];
+ body []
+ [
+ header;
+ topnav;
+ div [ id "main" ] [ main_content ];
+ footer "Marius PETER";
+ ];
+ ]
Copyright 2019--2025 Marius PETER