portfolio/web/components/projectList.go

37 lines
794 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),
b.Subtitle(6, A(Class("flex"), Href(project.Url), mdi.Github(), g.Text("checkout repo"))),
),
b.Content(
project.Description,
),
2024-05-18 13:43:22 +02:00
)
}