Files
elm-0.19-workshop/finished/src/Page/Errored.elm
Richard Feldman f17c09108d Add finished/
2018-05-01 21:49:22 -04:00

46 lines
1.1 KiB
Elm

module Page.Errored exposing (PageLoadError, pageLoadError, view)
{-| The page that renders when there was an error trying to load another page,
for example a Page Not Found error.
It includes a photo I took of a painting on a building in San Francisco,
of a giant walrus exploding the golden gate bridge with laser beams. Pew pew!
-}
import Data.Session exposing (Session)
import Html exposing (Html, div, h1, img, main_, p, text)
import Html.Attributes exposing (alt, class, id, tabindex)
import Views.Page exposing (ActivePage)
-- MODEL --
type PageLoadError
= PageLoadError Model
type alias Model =
{ activePage : ActivePage
, errorMessage : String
}
pageLoadError : ActivePage -> String -> PageLoadError
pageLoadError activePage errorMessage =
PageLoadError { activePage = activePage, errorMessage = errorMessage }
-- VIEW --
view : Session -> PageLoadError -> Html msg
view session (PageLoadError model) =
main_ [ id "content", class "container", tabindex -1 ]
[ h1 [] [ text "Error Loading Page" ]
, div [ class "row" ]
[ p [] [ text model.errorMessage ] ]
]