diff --git a/internal/shared/ui/anime_card.templ b/internal/shared/ui/anime_card.templ index 993449c..1d8e5b2 100644 --- a/internal/shared/ui/anime_card.templ +++ b/internal/shared/ui/anime_card.templ @@ -16,11 +16,7 @@ type AnimeCardProps struct { templ AnimeCard(props AnimeCardProps) { if props.CurrentNode {
- if props.ImageURL != "" { - { - } else { -
No image
- } + @animeCardPoster(props.ImageURL, props.Title, props.ImgClass)
{ props.Title }
@@ -28,21 +24,7 @@ templ AnimeCard(props AnimeCardProps) {
} else { - if props.Class == "notification-card" || props.Class == "schedule-card" { -
- if props.ImageURL != "" { - { - } else { -
No image
- } -
- } else { - if props.ImageURL != "" { - { - } else { -
No image
- } - } + @animeCardPoster(props.ImageURL, props.Title, props.ImgClass) if props.Class != "notification-card" && props.Class != "schedule-card" {
@@ -54,6 +36,16 @@ templ AnimeCard(props AnimeCardProps) { } } +templ animeCardPoster(imageURL, title, imgClass string) { +
+ if imageURL != "" { + { + } else { +
No image
+ } +
+} + func defaultString(val, fallback string) string { if val == "" { return fallback