Further filtering tweaks
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2023-03-28 19:35:57 -04:00
parent 41ccf212a9
commit 6ed6cbb33e
3 changed files with 37 additions and 25 deletions

View File

@ -56,9 +56,11 @@ i.fas, i.fab {
}
.category-tile:hover {
color: var(--dark-blue);
}
.category-tile.active {
color: var(--white);
background-color: var(--light-blue);
border-radius: 5px;
}
/* Intro */

View File

@ -2,7 +2,7 @@ module Pages.Top exposing (Model, Msg, Params, page)
import Enum exposing (Enum)
import Html exposing (Html, a, button, div, form, h2, h3, h5, i, img, input, label, li, option, p, select, span, text, ul)
import Html.Attributes exposing (alt, class, for, href, id, src, style, value)
import Html.Attributes exposing (alt, class, classList, for, href, id, src, style, value)
import Html.Attributes.Aria exposing (ariaLabel)
import Html.Events exposing (onClick, onInput)
import Http
@ -76,10 +76,10 @@ type Category
categories : Enum Category
categories =
Enum.create
[ ( "Apps", Apps )
[ ( "(Everything)", All )
, ( "Apps", Apps )
, ( "Utilities", Utilities )
, ( "Development", Development )
, ( "All", All )
]
@ -349,9 +349,16 @@ viewApp app =
]
viewCategories : ( String, Category ) -> Html Msg
viewCategories category =
div [ class "category-tile", onClick (FilterCategory (Tuple.first category)) ] [ text (Tuple.first category) ]
viewCategory : Model -> ( String, Category ) -> Html Msg
viewCategory model category =
div
[ classList
[ ( "category-tile", True )
, ( "active", categories.toString (Maybe.withDefault All model.filter_category) == Tuple.first category )
]
, onClick (FilterCategory (Tuple.first category))
]
[ text (Tuple.first category) ]
viewApps : Model -> Html Msg
@ -378,13 +385,13 @@ viewApps model =
[ h2 [ class "app-headings" ] [ text "Finding things" ]
, form []
[ div []
[ h3 [] [ text "Categories" ]
, div [] (List.map viewCategories categories.list)
]
, div []
[ h3 [] [ text "Search" ]
, input [ ariaLabel "search", id "text", onInput FilterText ] []
]
, div []
[ h3 [] [ text "Categories" ]
, div [] (List.map (viewCategory model) categories.list)
]
, div []
[ h3 [] [ text "Status" ]
, label [ for "level" ] [ text "Minimum score:" ]
@ -406,20 +413,23 @@ viewApps model =
[]
]
]
, div [ id "intro", class "card" ] [ div [ class "card-body" ] [
h2 [ class "app-headings card-title" ] [ text "Co-op Cloud Recipe Catalogue" ]
, text "You can use these recipes ("
, a [ href
"https://docs.coopcloud.tech/glossary/#recipe" ] [
text "What's a recipe?"
]
, div [ id "intro", class "card" ]
[ div [ class "card-body" ]
[ h2 [ class "app-headings card-title" ] [ text "Co-op Cloud Recipe Catalogue" ]
, text "You can use these recipes ("
, a
[ href
"https://docs.coopcloud.tech/glossary/#recipe"
]
[ text "What's a recipe?"
]
, text ") with "
, a [ href "https://coopcloud.tech" ] [
text "Co-op Cloud"
]
, a [ href "https://coopcloud.tech" ]
[ text "Co-op Cloud"
]
, text "."
]
]
]
, div [ class "row" ]
(List.map viewApp
(model.results

View File

@ -70,8 +70,8 @@ view { page, toMsg } model =
, body =
[ div [ class "background" ]
[ nav
[ class "navbar navbar-expand-lg sticky-top font-weight-bold" ]
[ a [ class "navbar-text", href (Route.toString Route.Top) ]
[ class "navbar navbar-expand-lg sticky-top" ]
[ a [ class "font-weight-bold navbar-text", href (Route.toString Route.Top) ]
[ img
[ src "/logo-2.png"
, class "d-inline-block align-top mr-2"