2023-05-12 10:57:42 +00:00
|
|
|
package navigation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/vugu/vgrouter"
|
|
|
|
"github.com/vugu/vugu"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SidebarEntry struct {
|
|
|
|
vgrouter.NavigatorRef
|
2023-05-12 20:07:04 +00:00
|
|
|
PageInfoRef
|
|
|
|
|
2023-05-12 10:57:42 +00:00
|
|
|
AttrMap vugu.AttrMap
|
2023-05-16 16:10:24 +00:00
|
|
|
classes string `vugu:"data"` // TODO: Use AttrMap to handle classes or something else
|
2023-05-12 10:57:42 +00:00
|
|
|
|
2023-05-16 16:10:24 +00:00
|
|
|
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!
|
2023-05-12 10:57:42 +00:00
|
|
|
|
2023-05-16 16:10:24 +00:00
|
|
|
URL string `vugu:"data"`
|
2023-05-12 10:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *SidebarEntry) handleClick(event vugu.DOMEvent) {
|
|
|
|
c.Navigate(c.URL, nil)
|
|
|
|
}
|
2023-05-12 20:07:04 +00:00
|
|
|
|
|
|
|
func (c *SidebarEntry) Compute(ctx vugu.ComputeCtx) {
|
|
|
|
if c.PageInfo != nil && c.PageInfo.Path == c.URL {
|
|
|
|
c.classes = "d3c-1683622560-selected"
|
|
|
|
} else {
|
|
|
|
c.classes = ""
|
|
|
|
}
|
|
|
|
}
|