Better define the page we are on (#126)

fixes #124
This commit is contained in:
Rok Garbas 2020-07-09 18:07:07 +02:00 committed by GitHub
parent 08c5d997dc
commit 9b796191a5
Failed to generate hash of commit
2 changed files with 8 additions and 1 deletions

View file

@ -360,7 +360,12 @@ viewNavigationItem :
-> Html Msg -> Html Msg
viewNavigationItem url ( path, title ) = viewNavigationItem url ( path, title ) =
li li
[ classList [ ( "active", path == url.path ) ] ] [ classList
[ ( "active"
, String.startsWith url.path path
)
]
]
[ a [ href path ] [ text title ] ] [ a [ href path ] [ text title ] ]

View file

@ -45,6 +45,7 @@ import Html.Attributes
, classList , classList
, href , href
, id , id
, placeholder
, type_ , type_
, value , value
) )
@ -748,6 +749,7 @@ view path title model viewSuccess outMsg =
, id "search-query-input" , id "search-query-input"
, autocomplete False , autocomplete False
, autofocus True , autofocus True
, placeholder <| "Search for " ++ path
, onInput (\x -> outMsg (QueryInput x)) , onInput (\x -> outMsg (QueryInput x))
, value <| Maybe.withDefault "" model.query , value <| Maybe.withDefault "" model.query
] ]