package ui import "fmt" type AnimeCardProps struct { ID int Title string ImageURL string // Options to customize the card behavior Class string // override default wrapper class ImgClass string // override default image class TitleClass string // override default title class CurrentNode bool // if true, renders a div instead of an anchor tag (useful for graph nodes) } templ AnimeCard(props AnimeCardProps) { if props.CurrentNode {
@animeCardPoster(props.ImageURL, props.Title, props.ImgClass)
{ props.Title }
{ children... }
} else { @animeCardPoster(props.ImageURL, props.Title, props.ImgClass) if props.Class != "notification-card" && props.Class != "schedule-card" {
{ props.Title }
} { children... }
} } templ animeCardPoster(imageURL, title, imgClass string) {
if imageURL != "" { { } else {
No image
}
} func defaultString(val, fallback string) string { if val == "" { return fallback } return val }