82 lines
1.4 KiB
Elm
82 lines
1.4 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)
|
|
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 []
|
|
[ nav [ class "navbar navbar-expand-lg navbar-dark bg-dark" ]
|
|
[ a [ class "navbar-brand", href (Route.toString Route.Top) ] [ text "abra apps" ]
|
|
, ul [ class "navbar-nav" ]
|
|
[ li [ class "nav-tem" ] [ a [ class "nav-link", href (Route.toString Route.About) ] [ text "about" ] ]
|
|
]
|
|
]
|
|
, div [ class "container-fluid" ] page.body
|
|
]
|
|
]
|
|
}
|