D3vugu-components/components/navigation/sidebar-entry.go
David Vogel 05713d8a4d Change theme and coloring
- Use accent color for selected sidebar entries
- Correct faded colors
2023-05-18 14:04:44 +02:00

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 = ""
}
}