D3vugu-components/components/navigation/sidebar.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

39 lines
1.1 KiB
Go

package navigation
import "github.com/vugu/vugu"
type Sidebar struct {
AttrMap vugu.AttrMap
MenuEntries vugu.Builder `vugu:"data"` // Menu content at the top. Either embedded into the sidebar or at the top edge.
Entries vugu.Builder `vugu:"data"` // Main content of the sidebar.
BottomEntries vugu.Builder `vugu:"data"` // Static bottom part of the sidebar.
Body vugu.Builder `vugu:"data"` // The body contains the content that is right to or behind the sidebar.
Minimized bool `vugu:"data"` // If true, the sidebar is reduced to icons.
sidebarClasses string
showBodyOverlay bool
}
func (c *Sidebar) Init(ctx vugu.InitCtx) {
c.Minimized = true // Sidebar defaults to minimized.
}
func (c *Sidebar) Compute(ctx vugu.ComputeCtx) {
if c.Minimized {
c.sidebarClasses = "d3c-1633357633-sidebar-minimized d3c-button-only-icon"
c.showBodyOverlay = false
} else {
c.sidebarClasses = ""
c.showBodyOverlay = true
}
}
func (c *Sidebar) handleMenuButton(event vugu.DOMEvent) {
c.Minimized = !c.Minimized
}
func (c *Sidebar) handleOverlayClick(event vugu.DOMEvent) {
c.Minimized = true
}