htmgo/sandbox/partials/nav.go

26 lines
479 B
Go
Raw Normal View History

2024-09-11 17:31:40 +00:00
package partials
2024-09-14 00:05:55 +00:00
import "github.com/maddalax/htmgo/framework/h"
2024-09-11 17:31:40 +00:00
type Link struct {
Name string
Path string
}
func NavBar() h.Ren {
2024-09-11 17:31:40 +00:00
links := []Link{
{"Home", "/"},
{"News", "/news"},
{"Patients", "/patients"},
}
2024-09-11 21:08:35 +00:00
return h.Nav(h.Class("flex gap-4 items-center p-4 text-slate-600"),
h.Boost(),
2024-09-11 21:08:35 +00:00
h.Children(
h.Map(links, func(link Link) h.Ren {
return h.A(h.Text(link.Name), h.Href(link.Path), h.Class("cursor-pointer hover:text-blue-400"))
})...,
2024-09-11 21:08:35 +00:00
))
2024-09-11 17:31:40 +00:00
}