glance/internal/widget/bookmarks.go

32 lines
657 B
Go
Raw Normal View History

2024-04-27 21:10:24 +02:00
package widget
import (
"html/template"
"github.com/glanceapp/glance/internal/assets"
)
type Bookmarks struct {
widgetBase `yaml:",inline"`
cachedHTML template.HTML `yaml:"-"`
Groups []struct {
Title string `yaml:"title"`
Color *HSLColorField `yaml:"color"`
Links []struct {
Title string `yaml:"title"`
URL string `yaml:"url"`
} `yaml:"links"`
} `yaml:"groups"`
}
func (widget *Bookmarks) Initialize() error {
widget.withTitle("Bookmarks").withError(nil)
widget.cachedHTML = widget.render(widget, assets.BookmarksTemplate)
return nil
}
func (widget *Bookmarks) Render() template.HTML {
return widget.cachedHTML
}