recipes.coopcloud.tech/src/Shared.elm

91 lines
1.8 KiB
Elm

module Shared exposing
( Flags
, Model
, Msg
, init
, subscriptions
, update
, view
)
import Browser.Navigation exposing (Key)
import Html exposing (..)
import Html.Attributes exposing (class, href, src, alt, width, height, style)
import Spa.Document exposing (Document)
import Spa.Generated.Route as Route
import Url exposing (Url)
-- INIT
type alias Flags =
()
type alias Model =
{ url : Url
, key : Key
}
init : Flags -> Url -> Key -> ( Model, Cmd Msg )
init flags url key =
( Model url key
, Cmd.none
)
-- UPDATE
type Msg
= ReplaceMe
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
ReplaceMe ->
( model, Cmd.none )
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
view :
{ page : Document msg, toMsg : Msg -> msg }
-> Model
-> Document msg
view { page, toMsg } model =
{ title = page.title
, body =
[ div [ class "background" ]
[ nav
[ class "navbar navbar-expand-lg sticky-top font-weight-bold" ]
[ a [ class "navbar-text", href (Route.toString Route.Top) ]
[ img
[ src "/logo-2.png"
, class "d-inline-block align-top mr-2"
, alt ""
, width 48
, height 16 ] []
, text "abra recipes"
]
, ul [ class "navbar-nav" ]
[ li [ class "nav-tem" ] [ a [ class "nav-link navbar-text", href (Route.toString Route.About) ] [ text "about" ] ]
]
]
, div [ class "container-fluid" ] page.body
]
]
}