portfolio/web/components/projectList.go

40 lines
886 B
Go
Raw Normal View History

2024-05-18 13:43:22 +02:00
package components
import (
2024-05-18 15:22:35 +02:00
"github.com/delaneyj/gomponents-iconify/iconify/mdi"
2024-05-18 13:43:22 +02:00
g "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
2024-05-18 15:22:35 +02:00
b "github.com/willoma/bulma-gomponents"
e "github.com/willoma/gomplements"
2024-06-24 15:50:57 +02:00
"portfolio/database/ent"
2024-05-18 13:43:22 +02:00
)
2024-06-24 15:50:57 +02:00
func ProjectList(projects []*ent.Project) g.Node {
return Div(Class("py-2 px-2"), g.Group(g.Map(projects, func(p *ent.Project) g.Node {
2024-05-18 15:22:35 +02:00
return Project(p)
})),
2024-05-18 13:43:22 +02:00
)
}
2024-06-24 15:50:57 +02:00
func Project(project *ent.Project) g.Node {
2024-05-18 15:22:35 +02:00
return b.Card(
b.Media(
b.MediaLeft(
b.ImageImg(
2024-06-24 15:50:57 +02:00
project.ImageURL,
2024-05-18 15:22:35 +02:00
e.Alt("project image"),
b.ImgSq64,
),
),
b.Title(4, project.Name),
2024-05-19 00:21:08 +02:00
b.Subtitle(
6,
2024-06-24 15:50:57 +02:00
A(Class("flex"), Href(project.URL), mdi.Github(), g.Text("Checkout repo")),
A(Class("flex"), Href(project.DocURL), mdi.Document(), g.Text("Docs"))),
2024-05-18 15:22:35 +02:00
),
b.Content(
2024-05-19 00:21:08 +02:00
g.Raw(project.Description),
2024-05-18 15:22:35 +02:00
),
2024-05-18 13:43:22 +02:00
)
}