Unify layout, centered horizontally
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/74
This commit is contained in:
parent
c5e09f4ba3
commit
d89c5f5a1b
1 changed files with 83 additions and 74 deletions
53
lib/views.ml
53
lib/views.ml
|
@ -80,8 +80,7 @@ h1,h2,h3{line-height:1.2}
|
||||||
}
|
}
|
||||||
|}
|
|}
|
||||||
|
|
||||||
let layout ?include_static_css ?(nav=`Default) ~title body =
|
let make_breadcrumbs nav =
|
||||||
let breadcrumb =
|
|
||||||
let to_nav kvs =
|
let to_nav kvs =
|
||||||
H.nav [
|
H.nav [
|
||||||
H.ul (
|
H.ul (
|
||||||
|
@ -131,14 +130,36 @@ let layout ?include_static_css ?(nav=`Default) ~title body =
|
||||||
Uuidm.pp build_right.uuid
|
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*)
|
(*> Note: Last declared CSS wins - so one can override here*)
|
||||||
let static_css = static_css :: Option.to_list include_static_css
|
let static_css = static_css :: Option.to_list include_static_css
|
||||||
in
|
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.html
|
||||||
(H.head (H.title (H.txt title))
|
(H.head (H.title (H.txt title))
|
||||||
[H.style ~a:H.[a_mime_type "text/css"] static_css])
|
[H.style ~a:H.[a_mime_type "text/css"] static_css])
|
||||||
|
|
||||||
(H.body [
|
(H.body [
|
||||||
breadcrumb;
|
breadcrumb;
|
||||||
H.main body
|
H.main body
|
||||||
|
@ -521,12 +542,12 @@ module Job_build = struct
|
||||||
~next
|
~next
|
||||||
|
|
||||||
let viz_style_deps = "
|
let viz_style_deps = "
|
||||||
width: 46em;
|
width: 45em;
|
||||||
height: 45.4em;
|
height: 45.4em;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 47vw;
|
max-height: 49vw;
|
||||||
min-width: 38em;
|
min-width: 38em;
|
||||||
min-height: 39em;
|
min-height: 40em;
|
||||||
"
|
"
|
||||||
|
|
||||||
let viz_style_treemap = "
|
let viz_style_treemap = "
|
||||||
|
@ -535,7 +556,7 @@ module Job_build = struct
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 52vw;
|
max-height: 52vw;
|
||||||
min-width: 38em;
|
min-width: 38em;
|
||||||
min-height: 41em;
|
min-height: 43em;
|
||||||
"
|
"
|
||||||
|
|
||||||
let make_viz_section ~name ~artifacts ~uuid =
|
let make_viz_section ~name ~artifacts ~uuid =
|
||||||
|
@ -586,33 +607,21 @@ module Job_build = struct
|
||||||
~latest ~next ~previous
|
~latest ~next ~previous
|
||||||
in
|
in
|
||||||
let style_grid = H.a_style "display: flex; " 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 =
|
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 style_col_right = H.a_style "width: 50%" in
|
||||||
let body = [
|
let body = [
|
||||||
H.div~a:[ style_grid_container ] [
|
|
||||||
H.div~a:[ style_col_container ] [
|
|
||||||
H.h1 [txtf "Job %s" name];
|
H.h1 [txtf "Job %s" name];
|
||||||
H.div~a:[ style_grid ] [
|
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_left ] left_column;
|
||||||
H.div~a:[ style_col_right ] right_column
|
H.div~a:[ style_col_right ] right_column
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
|
||||||
]
|
|
||||||
in
|
in
|
||||||
layout
|
layout
|
||||||
~nav:(`Build (name, build))
|
~nav:(`Build (name, build))
|
||||||
~title:(Fmt.str "Job %s %a" name pp_ptime build.start)
|
~title:(Fmt.str "Job %s %a" name pp_ptime build.start)
|
||||||
|
~manual_width:true
|
||||||
body
|
body
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue