Skip to content

Commit

Permalink
update to use AddTopBar instead of AddAppBar
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Sep 1, 2024
1 parent 6dc5def commit b2c81e0
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,39 @@ var content embed.FS
func main() {
b := core.NewBody("Cogent Core")
pg := pages.NewPage(b).SetContent(content)
b.AddAppBar(pg.MakeToolbar)
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
w.SetText("Blog").SetIcon(icons.RssFeed)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("/blog")
b.AddTopBar(func(bar *core.Frame) {
tb := core.NewToolbar(bar)
tb.Maker(pg.MakeToolbar)
tb.Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
w.SetText("Blog").SetIcon(icons.RssFeed)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("/blog")
})
})
})
tree.Add(p, func(w *core.Button) {
w.SetText("Videos").SetIcon(icons.VideoLibrary)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://youtube.com/@CogentCore")
tree.Add(p, func(w *core.Button) {
w.SetText("Videos").SetIcon(icons.VideoLibrary)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://youtube.com/@CogentCore")
})
})
})
tree.Add(p, func(w *core.Button) {
w.SetText("GitHub").SetIcon(icons.GitHub)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://github.com/cogentcore")
tree.Add(p, func(w *core.Button) {
w.SetText("GitHub").SetIcon(icons.GitHub)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://github.com/cogentcore")
})
})
})
tree.Add(p, func(w *core.Button) {
w.SetText("Community").SetIcon(icons.Forum)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("/community")
tree.Add(p, func(w *core.Button) {
w.SetText("Community").SetIcon(icons.Forum)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("/community")
})
})
})
tree.Add(p, func(w *core.Button) {
w.SetText("Sponsor").SetIcon(icons.Favorite)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://github.com/sponsors/cogentcore")
tree.Add(p, func(w *core.Button) {
w.SetText("Sponsor").SetIcon(icons.Favorite)
w.OnClick(func(e events.Event) {
pg.Context.OpenURL("https://github.com/sponsors/cogentcore")
})
})
})
})
Expand Down

0 comments on commit b2c81e0

Please sign in to comment.