Initial commit
This commit is contained in:
commit
02947128bc
24 changed files with 1126 additions and 0 deletions
22
ui/render.go
Normal file
22
ui/render.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package ui
|
||||
|
||||
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{
|
||||
templates: template.Must(template.ParseFS(htmlFS, "*.html")),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue