2020-01-13 01:23:46 +00:00
|
|
|
module Page exposing (..)
|
2020-01-13 00:02:11 +00:00
|
|
|
|
|
|
|
import Browser exposing (Document)
|
|
|
|
import Html exposing (Html, a, div, input, node, p, text)
|
|
|
|
import Html.Attributes exposing (href, placeholder, type_, value)
|
|
|
|
import Html.Events exposing (onInput)
|
|
|
|
|
|
|
|
|
|
|
|
template : String -> List (Html msg) -> Browser.Document msg
|
|
|
|
template title body =
|
|
|
|
{ title = title
|
|
|
|
, body =
|
|
|
|
[ node "main"
|
|
|
|
[]
|
|
|
|
[ navBar
|
|
|
|
, div [] body
|
|
|
|
, footer
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
navBar : Html msg
|
|
|
|
navBar =
|
|
|
|
node "nav"
|
|
|
|
[]
|
|
|
|
[ p []
|
|
|
|
[ viewLink "/" "Mi"
|
|
|
|
, text " - "
|
|
|
|
, viewLink "/switch" "Switch tracker"
|
|
|
|
, text " - "
|
|
|
|
, viewLink "/logout" "Logout"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
footer : Html msg
|
|
|
|
footer =
|
|
|
|
node "footer"
|
|
|
|
[]
|
|
|
|
[ p []
|
|
|
|
[ a [ href "https://within.website" ] [ text "From Within" ]
|
|
|
|
, text " - "
|
|
|
|
, a [ href "https://tulpa.dev/cadey/mi" ] [ text "Source code" ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
viewInput : String -> String -> String -> (String -> msg) -> Html msg
|
|
|
|
viewInput t p v toMsg =
|
|
|
|
input [ type_ t, placeholder p, value v, onInput toMsg ] []
|
|
|
|
|
|
|
|
|
|
|
|
viewLink : String -> String -> Html msg
|
|
|
|
viewLink path title =
|
|
|
|
a [ href path ] [ text title ]
|