You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
876 B
Go

1 year ago
package navigation
import "github.com/vugu/vugu"
type Sidebar struct {
AttrMap vugu.AttrMap
MenuEntries vugu.Builder // Menu content at the top. Either embedded into the sidebar or at the top edge.
Entries vugu.Builder // Main content of the sidebar.
1 year ago
BottomEntries vugu.Builder // Static bottom part of the sidebar.
Body vugu.Builder // The body contains the content that is right to or behind the sidebar.
Minimized bool // If true, the sidebar is reduced to icons.
sidebarClasses string
}
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"
} else {
c.sidebarClasses = ""
}
1 year ago
}
func (c *Sidebar) handleMenuButton(event vugu.DOMEvent) {
c.Minimized = !c.Minimized
1 year ago
}