From 9b796191a568ebb1bc021f891d838ee88cfe2c2f Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Thu, 9 Jul 2020 18:07:07 +0200 Subject: [PATCH] Better define the page we are on (#126) fixes #124 --- src/Main.elm | 7 ++++++- src/Search.elm | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Main.elm b/src/Main.elm index c1785eb..80540d5 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -360,7 +360,12 @@ viewNavigationItem : -> Html Msg viewNavigationItem url ( path, title ) = li - [ classList [ ( "active", path == url.path ) ] ] + [ classList + [ ( "active" + , String.startsWith url.path path + ) + ] + ] [ a [ href path ] [ text title ] ] diff --git a/src/Search.elm b/src/Search.elm index ec4fe44..993f575 100644 --- a/src/Search.elm +++ b/src/Search.elm @@ -45,6 +45,7 @@ import Html.Attributes , classList , href , id + , placeholder , type_ , value ) @@ -748,6 +749,7 @@ view path title model viewSuccess outMsg = , id "search-query-input" , autocomplete False , autofocus True + , placeholder <| "Search for " ++ path , onInput (\x -> outMsg (QueryInput x)) , value <| Maybe.withDefault "" model.query ]