templates/index.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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)), } }), ), ), }) } |