From 7592bd19eeffcebe5593235e431253278c3a194e Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Tue, 13 Feb 2024 03:56:25 -0500 Subject: [PATCH] Catalog - don't render intro if there's no subject --- src/Component/CatalogGrid.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Component/CatalogGrid.hs b/src/Component/CatalogGrid.hs index ca6f04e..5f55685 100644 --- a/src/Component/CatalogGrid.hs +++ b/src/Component/CatalogGrid.hs @@ -92,13 +92,7 @@ gridItem iface m post = , b_ [][ text post_count_str ] , "+" ] - , p_ - [ class_ "intro" ] - [ span_ - [ class_ "subject" ] - subject - ] - ] ++ body + ] ++ (intro subject) ++ body ) ] @@ -106,6 +100,15 @@ gridItem iface m post = subject :: [ View a ] subject = map (text . toMisoString) $ maybeToList $ CatalogPost.subject post + intro :: [ View a ] -> [ View a ] + intro [] = [] + intro x = (: []) $ p_ + [ class_ "intro" ] + [ span_ + [ class_ "subject" ] + x + ] + body :: [ View a ] body = map (rawHtml . toMisoString) $ maybeToList $ CatalogPost.body post