diff --git a/src/web/ui/sass/main.sass b/src/web/ui/sass/main.sass index fbb19967a..cd05256fa 100644 --- a/src/web/ui/sass/main.sass +++ b/src/web/ui/sass/main.sass @@ -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 diff --git a/src/web/ui/src/Accounts/View.fs b/src/web/ui/src/Accounts/View.fs index 0b301fb26..a5e0eb97c 100644 --- a/src/web/ui/src/Accounts/View.fs +++ b/src/web/ui/src/Accounts/View.fs @@ -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"][] diff --git a/src/web/ui/src/Controls/Table.fs b/src/web/ui/src/Controls/Table.fs index 977ee54f0..1d289ec0b 100644 --- a/src/web/ui/src/Controls/Table.fs +++ b/src/web/ui/src/Controls/Table.fs @@ -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 createCell r.cells) - | Some h -> tr [ ClassName r.className ] (th [] [str h] :: (List.map createCell r.cells)) +let createRow (isHeaderRow:bool) (r:row) = + match r.header, isHeaderRow with + | None, false -> tr [ ClassName r.className ] (List.map (createCell isHeaderRow) r.cells) + | None, true -> tr [ ClassName r.className ] (List.map (createCell isHeaderRow) r.cells) + | Some h, true -> tr [ ClassName r.className ] (th [] [str h] :: (List.map (createCell isHeaderRow) r.cells )) + | Some h, false -> tr [ ClassName r.className ] (th [] [str h] :: (List.map (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 (createRow false) rl let tbl = match headers with | Some h -> [ - thead [] [ createRow h ] - tbody [] (List.map createRow rl) + thead [] [ createRow true h] + tbody [] rws ] | None -> - [ tbody [] (List.map 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 [] \ No newline at end of file +let createTable (headers:row option) (rl:row list) = createTableWithStyle headers rl "" [] \ No newline at end of file diff --git a/src/web/ui/src/Users/View.fs b/src/web/ui/src/Users/View.fs index 7d1e638c2..e48e6df82 100644 --- a/src/web/ui/src/Users/View.fs +++ b/src/web/ui/src/Users/View.fs @@ -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) =