D3vugu-components/components/navigation/sidebar-entry.go
David Vogel 114a7d893c Add input field and a lot of other fixes
- Add input field and general data binding
- Rename SymbolSlot to IconSlot
- Remove d3c-color-accent
- Update icons page
- Add input example page
- Update button to support highlighting
- Update navigation entry to support highlighting
- Add d3c-button-only-icon to button and let sidebar use that
- Use d3c-button-transparent in sidebar
- Add focus indicator to buttons
- Rename CSS color variables and change definition of some
- Let pagination use input:Button
- Add some padding to the inline code component
2023-05-25 15:59:13 +02:00

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