1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

ui: Style error flash, add close link

This commit is contained in:
James Hillyerd
2018-11-25 09:06:28 -08:00
parent 4eb2d5ae97
commit 0cf97f5c58
3 changed files with 55 additions and 15 deletions

View File

@@ -33,6 +33,7 @@ type alias FrameControls msg =
, mailboxValue : String
, recentOptions : List String
, recentActive : String
, clearFlash : msg
}
@@ -58,7 +59,7 @@ frame controls session page content =
]
]
]
, div [] [ text ("Status: " ++ session.flash) ]
, errorFlash controls session.flash
]
, div [ id "navbg" ] [ text "" ]
, content
@@ -73,6 +74,21 @@ frame controls session page content =
]
errorFlash : FrameControls msg -> String -> Html msg
errorFlash controls message =
if message == "" then
text ""
else
div [ class "error" ]
[ div [ class "flash-header" ]
[ h2 [] [ text "Error" ]
, a [ href "#", Events.onClick controls.clearFlash ] [ text "Close" ]
]
, pre [] [ text message ]
]
externalLink : String -> String -> Html a
externalLink url title =
a [ href url, target "_blank", rel "noopener" ] [ text title ]