agendas/ui/render.go

23 lines
393 B
Go
Raw Normal View History

2024-12-30 17:30:37 -05:00
package ui
2024-12-23 20:57:58 -05:00
import (
"io"
"text/template"
"github.com/labstack/echo/v4"
)
type Renderer struct {
templates *template.Template
}
func (t *Renderer) Render(w io.Writer, name string, data any, c echo.Context) error {
return t.templates.ExecuteTemplate(w, name, data)
}
func NewRenderer() *Renderer {
return &Renderer{
2024-12-30 17:30:37 -05:00
templates: template.Must(template.ParseFS(htmlFS, "*html")),
2024-12-23 20:57:58 -05:00
}
}