switch to gomponents
1 file changed, 36 insertions(+), 0 deletions(-)
changed files
A templates/index.go
@@ -0,0 +1,36 @@ +package templates + +import ( + "time" + + g "go.alanpearce.eu/gomponents" + . "go.alanpearce.eu/gomponents/html" +) + +type RepoInfo struct { + DisplayName string + Name string + Desc string + Idle string + LastCommit time.Time +} + +func Index(data PageData, repos []RepoInfo) g.Node { + return Page(data, g.Group{ + Header( + H1(g.Text(data.Meta.Title)), + H2(g.Text(data.Meta.Description)), + ), + Main( + Div(Class("index"), + g.Map(repos, func(repo RepoInfo) g.Node { + return g.Group{ + Div(Class("index-name"), A(Href("/"+repo.Name), g.Text(repo.DisplayName))), + Div(Class("desc"), g.Text(repo.Desc)), + Div(g.Text(repo.Idle)), + } + }), + ), + ), + }) +}