32 lines
739 B
Go
32 lines
739 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
|
|
|
|
SymbolSlot 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-color-accent d3c-1683622560-selected"
|
|
} else {
|
|
c.classes = ""
|
|
}
|
|
}
|