ui: extract generic AnimeCard component and adopt in watchlist and catalog

This commit is contained in:
2026-04-08 18:10:26 +02:00
parent 0f338ba9ee
commit b83f7f8ab3
3 changed files with 32 additions and 18 deletions

View File

@@ -0,0 +1,22 @@
package ui
import "fmt"
type AnimeCardProps struct {
ID int
Title string
ImageURL string
}
templ AnimeCard(props AnimeCardProps) {
<a href={ templ.URL(fmt.Sprintf("/anime/%d", props.ID)) }>
if props.ImageURL != "" {
<img src={ props.ImageURL } alt={ props.Title } class="catalog-thumb" loading="lazy"/>
} else {
<div class="no-image">No image</div>
}
</a>
<div class="catalog-title">
{ props.Title }
</div>
}