Created
February 1, 2017 08:53
-
-
Save slapers/a1d49d93805da316fd799580b95d8bd4 to your computer and use it in GitHub Desktop.
Modal starter, not working/finished yet
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
| module App.UiModal exposing (..) | |
| import Html exposing (..) | |
| import Html.Attributes exposing (..) | |
| import Html.Events exposing (..) | |
| type alias Modal = | |
| { content : Maybe String | |
| } | |
| type Msg | |
| = ShowModal String | |
| | HideModal | |
| (=>) : a -> b -> ( a, b ) | |
| (=>) = | |
| (,) | |
| updateModal : Maybe String -> Modal -> Modal | |
| updateModal content modal = | |
| { modal | content = content } | |
| viewModal : (Msg -> msg) -> Modal -> Html msg | |
| viewModal tagging modal = | |
| case modal.content of | |
| Nothing -> viewEmptyModal | |
| Just _ -> viewModalWithContent | |
| viewEmptyModal : Html Never | |
| viewEmptyModal = | |
| div [ style [ "display" => "none" ] ] [] | |
| viewModalWithContent : (Msg -> msg) -> Modal -> Html msg | |
| viewModalWithContent | |
| div | |
| [ style | |
| [ "position" => "absolute" | |
| , "height" => "100%" | |
| , "width" => "100%" | |
| , "background-color" => "rgba(0, 0, 0, 0.2)" | |
| ] | |
| , onClick (tagging HideModal) | |
| ] | |
| [ text "test" | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment