Unify layout, centered horizontally

Reviewed-on: https://git.robur.io/robur/builder-web/pulls/74
This commit is contained in:
Reynir Björnsson 2022-02-07 15:38:12 +00:00
parent c5e09f4ba3
commit d89c5f5a1b

View file

@ -80,8 +80,7 @@ h1,h2,h3{line-height:1.2}
}
|}
let layout ?include_static_css ?(nav=`Default) ~title body =
let breadcrumb =
let make_breadcrumbs nav =
let to_nav kvs =
H.nav [
H.ul (
@ -131,14 +130,36 @@ let layout ?include_static_css ?(nav=`Default) ~title body =
Uuidm.pp build_right.uuid
);
]
in
let layout
?include_static_css
?(nav=`Default)
?(manual_width=false)
~title
body
=
let breadcrumb = make_breadcrumbs nav in
(*> Note: Last declared CSS wins - so one can override here*)
let static_css = static_css :: Option.to_list include_static_css
in
let body =
let style_grid_container = H.a_style "\
display: flex;
align-items: center;
justify-content: center;
min-width: 83em;
"
and style_grid = H.a_style @@
if manual_width then "" else "\
width: 76%;\
"
in
[ H.div ~a:[ style_grid_container ]
[ H.div ~a:[ style_grid ] body ]]
in
H.html
(H.head (H.title (H.txt title))
[H.style ~a:H.[a_mime_type "text/css"] static_css])
(H.body [
breadcrumb;
H.main body
@ -521,12 +542,12 @@ module Job_build = struct
~next
let viz_style_deps = "
width: 46em;
width: 45em;
height: 45.4em;
max-width: 100%;
max-height: 47vw;
max-height: 49vw;
min-width: 38em;
min-height: 39em;
min-height: 40em;
"
let viz_style_treemap = "
@ -535,7 +556,7 @@ module Job_build = struct
max-width: 100%;
max-height: 52vw;
min-width: 38em;
min-height: 41em;
min-height: 43em;
"
let make_viz_section ~name ~artifacts ~uuid =
@ -586,33 +607,21 @@ module Job_build = struct
~latest ~next ~previous
in
let style_grid = H.a_style "display: flex; " in
let style_grid_container = H.a_style "\
display: flex;
align-items: center;
justify-content: center;
min-width: 83em;
"
in
let style_col_container = H.a_style "" in
let style_col_left =
H.a_style "width: 45em; min-width: 43em; padding-left: 2%" in
H.a_style "width: 45em; min-width: 43em;" in
let style_col_right = H.a_style "width: 50%" in
let body = [
H.div~a:[ style_grid_container ] [
H.div~a:[ style_col_container ] [
H.h1 [txtf "Job %s" name];
H.div~a:[ style_grid ] [
(* H.div~a:H.[ style_col_padding ] []; *)
H.div~a:[ style_col_left ] left_column;
H.div~a:[ style_col_right ] right_column
]
]
]
]
in
layout
~nav:(`Build (name, build))
~title:(Fmt.str "Job %s %a" name pp_ptime build.start)
~manual_width:true
body
end