newsbot-portal/internal/views/articles/table.templ

35 lines
933 B
Plaintext

package articles
import (
"git.jamestombleson.com/jtom38/newsbot-portal/components/bulma"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/models"
"git.jamestombleson.com/jtom38/newsbot-portal/internal/views/layout"
)
templ ListArticlesTable(model models.ListArticlesViewModel) {
@layout.WithTemplate(model.HeaderMetaTags) {
@bulma.Table() {
@bulma.TableHeader() {
@bulma.TableRow() {
@bulma.TableHeaderData("Title")
@bulma.TableHeaderData("Source")
@bulma.TableHeaderDataToolTip("Pub", "Date Published")
@bulma.TableHeaderData("View")
}
}
for _, item := range model.Items {
@bulma.TableRow() {
@bulma.TableData(item.Article.Title)
@bulma.TableData(item.Source.DisplayName)
@bulma.TableData(item.Article.PubDate.String())
@bulma.TableDataChildren() {
@bulma.Button() {
@bulma.ANewTab(item.Article.Url, "View")
}
}
}
}
}
}
}