Skip to content

Commit

Permalink
Only show modal header or footer if there is content there.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Feb 23, 2017
1 parent bc241a0 commit a1e2bb6
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions source/Ui/Modal.elm
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ render viewModel model =
[ Ui.Icons.close [ closeEvent ] ]
else
[]

footer =
if List.isEmpty viewModel.footer then
text ""
else
node "ui-modal-footer" [] viewModel.footer

header =
if String.isEmpty viewModel.title then
text ""
else
node "ui-modal-header"[]
([ node "ui-modal-title" [] [ text viewModel.title ] ] ++ closeIcon)
in
node
"ui-modal"
Expand All @@ -137,10 +150,9 @@ render viewModel model =
|> List.concat
)
([ node "ui-modal-wrapper" []
[ node "ui-modal-header"[]
([ node "ui-modal-title" [] [ text viewModel.title ] ] ++ closeIcon)
[ header
, node "ui-modal-content" [] viewModel.contents
, node "ui-modal-footer" [] viewModel.footer
, footer
]
] ++ (if model.backdrop then backdrop else [] ))

Expand Down

0 comments on commit a1e2bb6

Please sign in to comment.