module Page exposing (..) import Browser exposing (Document) import Html exposing (Html, a, div, input, node, p, span, text) import Html.Attributes exposing (class, href, placeholder, style, 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" , span [ class "right" ] [ 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 ]