summaryrefslogtreecommitdiff
path: root/lib/views/layouts.ml
blob: d9def3c2d09250780b9bceb2022db16b1bcea47a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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