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-05-18 13:43:22 +02:00
"portfolio/web/types"
)
func ProjectList(projects []types.Project) g.Node {
2024-05-18 15:22:35 +02:00
return Div(Class("py-2 px-2"), g.Group(g.Map(projects, func(p types.Project) g.Node {
return Project(p)
})),
2024-05-18 13:43:22 +02:00
)
}
func Project(project types.Project) g.Node {
2024-05-18 15:22:35 +02:00
return b.Card(
b.Media(
b.MediaLeft(
b.ImageImg(
project.ImageUrl,
e.Alt("project image"),
b.ImgSq64,
),
),
b.Title(4, project.Name),
2024-05-19 00:21:08 +02:00
b.Subtitle(
6,
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
)
}