You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
719 B
Go

package navigation
import (
"github.com/vugu/vgrouter"
"github.com/vugu/vugu"
)
type SidebarEntry struct {
vgrouter.NavigatorRef
PageInfoRef
AttrMap vugu.AttrMap
classes string `vugu:"data"` // TODO: Use AttrMap to handle classes or something else
IconSlot vugu.Builder `vugu:"data"` // Slot for the symbol.
DefaultSlot vugu.Builder `vugu:"data"` // Slot for the text and other stuff. Should be a div element!
URL string `vugu:"data"`
}
func (c *SidebarEntry) handleClick(event vugu.DOMEvent) {
c.MustNavigate(c.URL, nil)
}
func (c *SidebarEntry) Compute(ctx vugu.ComputeCtx) {
if c.PageInfo != nil && c.PageInfo.Path == c.URL {
c.classes = "d3c-button-highlight"
} else {
c.classes = ""
}
}