diff --git a/src/Main.elm b/src/Main.elm index 7a09854..16a73cc 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -252,39 +252,60 @@ update msg model = -- VIEW -view : Model -> Html Msg +view : + Model + -> + { title : String + , body : List (Html Msg) + } view model = - div [] - [ header [] - [ div [ class "navbar navbar-static-top" ] - [ div [ class "navbar-inner" ] - [ div [ class "container" ] - [ a [ class "brand", href "https://nixos.org" ] - [ img [ src "https://nixos.org/logo/nix-wiki.png", class "logo" ] [] - ] - , div [ class "nav-collapse collapse" ] - [ ul [ class "nav pull-left" ] - (viewNavigation model.page model.url) + let + title = + case model.page of + Packages _ -> + "NixOS Search - Packages" + + Options _ -> + "NixOS Search - Options" + + _ -> + "NixOS Search" + in + { title = title + , body = + [ div [] + [ header [] + [ div [ class "navbar navbar-static-top" ] + [ div [ class "navbar-inner" ] + [ div [ class "container" ] + [ a [ class "brand", href "https://nixos.org" ] + [ img [ src "https://nixos.org/logo/nix-wiki.png", class "logo" ] [] + ] + , div [ class "nav-collapse collapse" ] + [ ul [ class "nav pull-left" ] + (viewNavigation model.page model.url) + ] ] ] ] ] - ] - , div [ class "container main" ] - [ div [ id "content" ] [ viewPage model ] - , footer - [ class "container text-center" ] - [ div [] - [ span [] [ text "Elasticsearch instance graciously provided by " ] - , a [ href "https://bonsai.io" ] [ text "Bonsai" ] - , span [] [ text "." ] - ] - , div [] - [ span [] [ text "❤️ Thank you ❤️ " ] + , div [ class "container main" ] + [ div [ id "content" ] [ viewPage model ] + , footer + [ class "container text-center" ] + [ div [] + [ span [] [ text "Elasticsearch instance graciously provided by " ] + , a [ href "https://bonsai.io" ] [ text "Bonsai" ] + , span [] [ text "." ] + ] + , div [] + [ span [] [ text "❤️ Thank you ❤️ " ] + ] ] ] ] ] + } viewNavigation : Page -> Url.Url -> List (Html Msg) @@ -367,9 +388,5 @@ main = , onUrlChange = ChangedUrl , subscriptions = subscriptions , update = update - , view = - \m -> - { title = "NixOS Search" - , body = [ view m ] - } + , view = view } diff --git a/src/index.html b/src/index.html index 1f711f7..02f9b58 100644 --- a/src/index.html +++ b/src/index.html @@ -4,7 +4,7 @@ - Elm hotloading dev environment + NixOS Search - Loading...