ui: extract generic AnimeCard component and adopt in watchlist and catalog
This commit is contained in:
22
internal/shared/ui/anime_card.templ
Normal file
22
internal/shared/ui/anime_card.templ
Normal 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>
|
||||
}
|
||||
Reference in New Issue
Block a user