Files
crowsnest/src/web/html/articlePage.go

56 lines
1.2 KiB
Go

package html
import (
"crowsnest/internal/model"
g "maragu.dev/gomponents"
h "maragu.dev/gomponents/html"
)
func ArticlePageColumn(key string, value string) g.Node {
return h.P(
h.Span(
h.Class("badge badge-neutral me-4 w-20"),
g.Text(key),
),
g.Text(value),
)
}
func ArticlePage(articlePageVM *model.ArticlePageViewModel) g.Node {
return h.Div(
h.TabIndex("0"),
h.Class("card bg-base-200 shadow mb-4"),
h.Div(
h.Class("card-body"),
h.Div(
h.Class("flex flex-row pb-4"),
h.Div(
h.Class("divider divider-horizontal divider-primary"),
),
h.Div(
h.Class("card-title font-medium"),
g.Text(articlePageVM.Title),
),
),
h.Div(
h.Class("px-5 pb-4 grid gap-y-4 grid-cols-1"),
ArticlePageColumn("Datum", articlePageVM.PublishDate),
ArticlePageColumn("Quelle", articlePageVM.ShortSource),
ArticlePageColumn("TLDR", articlePageVM.Summary),
ArticlePageColumn("Inhalt", articlePageVM.Content),
h.Div(
h.Class("card-actions justify-end"),
h.A(
h.Href(articlePageVM.SourceUrl),
h.Button(
h.Class("btn btn-primary btn-sm"),
g.Text("Seite besuchen"),
),
),
),
),
),
)
}