Created
January 17, 2018 12:49
-
-
Save joshhornby/a690d46033bf85b7570f5289b8b69510 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
view : Model -> Html msg | |
view model = | |
renderItemsWithDefault renderList emptyState model.strings | |
renderList : List String -> Html msg | |
renderList strings = | |
ul [] <| List.map (\s -> li [] [ text s ] ) strings | |
emptyState : Html msg | |
emptyState = | |
p [] [ text "No results" ] | |
renderItemsWithDefault : (List a -> Html msg) -> Html msg -> List a -> Html msg | |
renderItemsWithDefault f default list = | |
case list of | |
[] -> default | |
list -> f list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment