SPARK-1201: Fix and style table headers

This commit is contained in:
Michael Harding committed 2018-06-07 10:21:14 -04:00
1 parent af39aab153
commit df784e9961
4 files changed
+26 -16

No files matched your search

+7
View File
@@ -51,6 +51,13 @@ input[type=text], input[type=password]
input[type=text].login-input, input[type=password].login-input
width: 100%
.table-bordered
border: 1px solid $border
thead th
background-color: $brand_primary
color: $white
font-weight: normal
.btstable td
vertical-align: middle
+3 -3
View File
@@ -202,7 +202,7 @@ let clipLimitsView model dispatch =
let addRow _ = Array.append model.scratch.securityClipLimits.limit [| emptyLimit |] |> (ClipLimits >> dispatch)
div []
[
TableControl.createTableWithStyle (Some headerRow) rws [Width "100%"; Border "1px solid lightgray"]
TableControl.createTableWithStyle (Some headerRow) rws "table-bordered" [Width "100%"]
span [ClassName "is-pulled-right"] [ Button.button "Add" "contrast-button" "plus" Button.Enabled addRow ]
span [ClassName "is-clearfix"][]
]
@@ -311,7 +311,7 @@ let productLimits model dispatch =
div []
[
h1 [ ClassName "is-size-4" ][str "Product Limits"]//; span [ClassName "is-size-7 has-text-grey-light"][ str " This is a limit for products"] ]
TableControl.createTableWithStyle (Some headerRow) rws [Width "100%"; Border "1px solid lightgray"]
TableControl.createTableWithStyle (Some headerRow) rws "table-bordered" [Width "100%"]
span [ClassName "is-pulled-right"] [ Button.button "Add" "contrast-button" "plus" Button.Enabled addRow ]
span [ClassName "is-clearfix"][]
]
@@ -447,7 +447,7 @@ let securityLimits model dispatch =
div []
[
h1 [ ClassName "is-size-4" ][str "Security Limits"]//; span [ClassName "is-size-7 has-text-grey-light"][ str " This is a limit for Securities"]]
TableControl.createTableWithStyle (Some headerRow) rws [Width "100%"; Border "1px solid lightgray"]
TableControl.createTableWithStyle (Some headerRow) rws "table-bordered" [Width "100%"]
span [ClassName "is-pulled-right"] [ Button.button "Add" "contrast-button" "plus" Button.Enabled addRow ]
span [ClassName "is-clearfix"][]
+15 -12
View File
@@ -16,26 +16,29 @@ type row = {
header:string option
}
let createCell (c:cell) =
match c.isHeader with
let createCell (inHeaderRow:bool) (c:cell) =
match c.isHeader || inHeaderRow with
| false -> td [ ClassName c.className; ColSpan (float c.colSpan) ] [ c.content ]
| true -> th [ ClassName c.className; ColSpan (float c.colSpan) ] [ c.content ]
let createRow (r:row) =
match r.header with
| None -> tr [ ClassName r.className ] (List.map<cell, ReactElement> createCell r.cells)
| Some h -> tr [ ClassName r.className ] (th [] [str h] :: (List.map<cell, ReactElement> createCell r.cells))
let createRow (isHeaderRow:bool) (r:row) =
match r.header, isHeaderRow with
| None, false -> tr [ ClassName r.className ] (List.map<cell, ReactElement> (createCell isHeaderRow) r.cells)
| None, true -> tr [ ClassName r.className ] (List.map<cell, ReactElement> (createCell isHeaderRow) r.cells)
| Some h, true -> tr [ ClassName r.className ] (th [] [str h] :: (List.map<cell, ReactElement> (createCell isHeaderRow) r.cells ))
| Some h, false -> tr [ ClassName r.className ] (th [] [str h] :: (List.map<cell, ReactElement> (createCell isHeaderRow) r.cells ))
let createTableWithStyle (headers:row option) (rl:row list) styles =
let createTableWithStyle (headers:row option) (rl:row list) className styles =
let rws = List.map<row,ReactElement> (createRow false) rl
let tbl = match headers with
| Some h ->
[
thead [] [ createRow h ]
tbody [] (List.map<row,ReactElement> createRow rl)
thead [] [ createRow true h]
tbody [] rws
]
| None ->
[ tbody [] (List.map<row,ReactElement> createRow rl) ]
table [ ClassName "table is-narrow btstable"; Style styles ] tbl
[ tbody [] rws ]
table [ ClassName (sprintf "table is-narrow btstable %s" className); Style styles ] tbl
let createTable (headers:row option) (rl:row list) = createTableWithStyle headers rl []
let createTable (headers:row option) (rl:row list) = createTableWithStyle headers rl "" []
+1 -1
View File
@@ -101,7 +101,7 @@ let accountsTabContent (model:Model) (dispatch:Msg->Unit) =
div []
[
TableControl.createTable (Some headerRow) rows
TableControl.createTableWithStyle (Some headerRow) rows "table-bordered" []
]
let mdEntitlementsTabContent (model:Model) (dispatch:Msg->Unit) =