wisski-cloud-distillery/internal/dis/component/menu.go
2023-01-12 13:55:07 +01:00

40 lines
575 B
Go

package component
import (
"html/template"
"net/http"
)
// Menuable is a component that provides a menu
type Menuable interface {
Component
Menu(r *http.Request) []MenuItem
}
type MenuItem struct {
Title string
Path template.URL
Active bool
Priority MenuPriority // menu priority
}
func MenuItemSort(a, b MenuItem) bool {
return a.Priority < b.Priority
}
type MenuPriority int
// Menu* indicates priorities of the menu
const (
MenuHome MenuPriority = iota
MenuNews
MenuResolver
MenuUser
MenuAdmin
MenuAuth
)
const (
SmallButton MenuPriority = -1
)