28 lines
695 B
Templ
28 lines
695 B
Templ
package views
|
|
|
|
import "fmt"
|
|
import "github.com/dominicf2001/comfychan/internal/util"
|
|
|
|
type CatalogThreadPreview struct {
|
|
Subject string
|
|
Body string
|
|
ThreadURL string
|
|
MediaPath string
|
|
}
|
|
|
|
templ ThreadsCatalog(previews []CatalogThreadPreview) {
|
|
<div id="catalog">
|
|
for _, preview := range previews {
|
|
<div class="catalog-preview">
|
|
<a href={ templ.URL(preview.ThreadURL) }>
|
|
<img class="catalog-preview-img" src={ fmt.Sprintf("/static/img/posts/%s", preview.MediaPath) }/>
|
|
</a>
|
|
<h1><a href={ templ.URL(preview.ThreadURL) } class="catalog-preview-link">{ preview.Subject }</a></h1>
|
|
<p>
|
|
@templ.Raw(util.EnrichPost(preview.Body))
|
|
</p>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|