From 468f7e10558c0e402dba2c9141c91c86da18873e Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Tue, 20 Jul 2021 13:50:30 +0200 Subject: [PATCH] Use string-extra.ellipsis to truncate descriptions --- elm.json | 1 + src/Pages/Top.elm | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/elm.json b/elm.json index e114016..098e12a 100644 --- a/elm.json +++ b/elm.json @@ -14,6 +14,7 @@ "elm/regex": "1.0.0", "elm/url": "1.0.0", "elm-community/json-extra": "4.3.0", + "elm-community/string-extra": "4.0.1", "pablohirafuji/elm-markdown": "2.0.5" }, "indirect": { diff --git a/src/Pages/Top.elm b/src/Pages/Top.elm index 7064ab7..4fbf6b1 100644 --- a/src/Pages/Top.elm +++ b/src/Pages/Top.elm @@ -11,6 +11,7 @@ import Spa.Document exposing (Document) import Spa.Generated.Route as Route import Spa.Page as Page exposing (Page) import Spa.Url as Url exposing (Url) +import String.Extra exposing (ellipsis) import Util exposing (Direction(..), andThen, by) @@ -183,7 +184,7 @@ viewApp app = , div [ class "card-body" ] [ h5 [ class "card-title" ] [ a [ href app_href ] [ text app.name ] ] - , p [] [ text (withDefault "" app.description) ] + , p [] [ text (ellipsis 100 (withDefault "" app.description)) ] , repository_link , website_link , a [ class "card-link", href app_href ]