on master help sign in
Visual imporvements on search page

- Added [Code] and [About] links at the botoom of the page - Added error message for empty search results

commit08b1af40f5af629381617580e3d04b56f8ff24a1 authorEvangelos Lamprou <e.lamprou@upnet.gr> dateFri 20 Oct 2023, 01:51 (3 years ago) parentb49ee60
2 files changed+56−5
frontend/assets/css/main.css+21 frontend/src/Main.elm+35−5
frontend/assets/css/main.css+21
@@ -34,3 +34,24 @@
3434.search:hover {
3535 text-decoration: underline;
3636}
37+
38+.wavy {
39+ animation-name: wavy;
40+ animation-duration: 4.2s;
41+ animation-timing-function: ease-in-out;
42+ animation-iteration-count: infinite;
43+ position: relative;
44+ top: 0;
45+ left: 0;
46+}
47+@keyframes wavy {
48+ 0% {
49+ top: 0px;
50+ }
51+ 50% {
52+ top: -15px;
53+ }
54+ 100% {
55+ top: 0px;
56+ }
57+}
frontend/src/Main.elm+35−5
@@ -27,7 +27,6 @@ import Ur.Sub
2727import Ur.Types exposing (Noun(..))
2828import Html.String
2929import List
30−import Css
3130import Html.Styled.Attributes exposing (css)
3231import Html.Parser
3332import String.Extra exposing (stripTags)
@@ -108,7 +107,8 @@ main =
108107 [ view model
109108 |> layout
110109 [ Font.family
111− [ Font.typeface "system-ui"
110+ [ Font.typeface "monospace"
111+ , Font.typeface "system-ui"
112112 , Font.typeface "-apple-system"
113113 , Font.typeface "BlinkMacSystemFont"
114114 , Font.typeface "Segoe UI"
@@ -116,6 +116,7 @@ main =
116116 , Font.typeface "Helvetica"
117117 , Font.typeface "Arial"
118118 , Font.sansSerif
119+ ]
119120 , clipX
120121 ]
121122 ]
@@ -159,6 +160,29 @@ logoView attributes =
159160 Element.image (List.append [ Html.Attributes.id "tilt" |> htmlAttribute ] attributes)
160161 { src = "assets/img/logo.png", description = "%seax logo" }
161162
163+noSearchResultsView : Element Msg
164+noSearchResultsView = Element.el
165+ [ Html.Attributes.style "padding" "1em" |> htmlAttribute
166+ , width (px 500)
167+ , Font.size 15
168+ , Html.Attributes.class "wavy" |> htmlAttribute
169+ ]
170+ (Element.text """No results found... :)
171+We'll try and find you something.
172+Just come back later.""")
173+
174+subtleLink : String -> String -> Element Msg
175+subtleLink text href =
176+ Element.el
177+ [ Font.size 15
178+ , pointer
179+ , mouseOver
180+ [ Font.color (rgb 0.7 0.7 0.7)
181+ ]
182+ ]
183+ (Element.html (Html.a [ Html.Attributes.href href ] [ Html.text text ]))
184+
185+
162186view : Model -> Element Msg
163187view model =
164188 case model.initiatedSearch of
@@ -219,8 +243,10 @@ view model =
219243 ]
220244 )
221245 ]
222− , Element.html (Html.hr [Html.Attributes.style "width" "95%"] [])
223− , Keyed.column [ width (minimum 0 fill), padding 8 ]
246+ , (if List.isEmpty model.searchResults then
247+ noSearchResultsView
248+ else
249+ Keyed.column [ width (minimum 0 fill), padding 8 ]
224250 (model.searchResults
225251 |> List.filter
226252 (\{ engines } ->
@@ -279,9 +305,13 @@ view model =
279305 ]
280306 )
281307 )
282− )
308+ ))
283309 , Element.html (Html.hr [Html.Attributes.style "width" "95%"] [])
310+ , row [ centerX, padding 10, spacing 10]
311+ [ subtleLink "[About]" "https://vagos.github.io/seax"
312+ , subtleLink "[Code]" "https://github.com/ilyakooo0/seax"
284313 ]
314+ ]
285315
286316
287317searchView : { a | search : String } -> Element Msg