on master help sign in
Added about on main page and enter to search.
1e49ae3Evangelos Lamprou
frontend/src/Main.elm+34−8
@@ -171,17 +171,25 @@ noSearchResultsView = Element.el
171We'll try and find you something.
171We'll try and find you something.
172Just come back later.""")
172Just come back later.""")
173
173
174−subtleLink : String -> String -> Element Msg
174+subtleLinkView : String -> String -> Element Msg
175−subtleLink text href =
175+subtleLinkView text href =
176 Element.el
176 Element.el
177 [ Font.size 15
177 [ Font.size 15
178 , pointer
178 , pointer
179 , mouseOver
179 , mouseOver
180− [ Font.color (rgb 0.7 0.7 0.7)
180+ [ Font.color (rgb 0.1 0.7 0.7)
181 ]
181 ]
182 ]
182 ]
183 (Element.html (Html.a [ Html.Attributes.href href ] [ Html.text text ]))
183 (Element.html (Html.a [ Html.Attributes.href href ] [ Html.text text ]))
184
184
185+aboutView : Element Msg
186+aboutView = row [ centerX, padding 10, spacing 10]
187+ [ subtleLinkView "[About]" "https://vagos.github.io/seax"
188+ , subtleLinkView "[Code]" "https://github.com/ilyakooo0/seax"
189+ ]
190+
191+
192+
185
193
186view : Model -> Element Msg
194view : Model -> Element Msg
187view model =
195view model =
@@ -190,6 +198,7 @@ view model =
190 column [ centerX, centerY, padding 8, spacing 16 ]
198 column [ centerX, centerY, padding 8, spacing 16 ]
191 [ logoView [ centerX, width (px 510), height (px 161) ]
199 [ logoView [ centerX, width (px 510), height (px 161) ]
192 , searchView model
200 , searchView model
201+ , aboutView
193 ]
202 ]
194
203
195 Just _ ->
204 Just _ ->
@@ -307,17 +316,34 @@ view model =
307 )
316 )
308 ))
317 ))
309 , Element.html (Html.hr [Html.Attributes.style "width" "95%"] [])
318 , Element.html (Html.hr [Html.Attributes.style "width" "95%"] [])
310− , row [ centerX, padding 10, spacing 10]
319+ , aboutView
311− [ subtleLink "[About]" "https://vagos.github.io/seax"
312− , subtleLink "[Code]" "https://github.com/ilyakooo0/seax"
313 ]
320 ]
314− ]
321+
322+
323+onEnter : msg -> Element.Attribute msg
324+onEnter msg =
325+ Element.htmlAttribute
326+ (Html.Events.on "keyup"
327+ (JD.field "key" JD.string
328+ |> JD.andThen
329+ (\key ->
330+ if key == "Enter" then
331+ JD.succeed msg
332+
333+ else
334+ JD.fail "Not the enter key"
335+ )
336+ )
337+ )
315
338
316
339
317searchView : { a | search : String } -> Element Msg
340searchView : { a | search : String } -> Element Msg
318searchView model =
341searchView model =
319 row [ spacing 8 ]
342 row [ spacing 8 ]
343+ [ Input.text
320− [ Input.text [ Html.Attributes.class "shadow" |> htmlAttribute, width (px 400)]
344+ [ Html.Attributes.class "shadow" |> htmlAttribute, width (px 400)
345+ , onEnter (Search model.search)
346+ ]
321 { onChange = UpdateSearch
347 { onChange = UpdateSearch
322 , placeholder = Nothing
348 , placeholder = Nothing
323 , text = model.search
349 , text = model.search