mirror of
https://github.com/jsiebens/ionscale.git
synced 2026-03-31 15:07:49 +01:00
20 lines
354 B
Go
20 lines
354 B
Go
package templates
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/a-h/templ"
|
|
"github.com/labstack/echo/v4"
|
|
"io"
|
|
)
|
|
|
|
type Renderer struct {
|
|
}
|
|
|
|
func (t *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
|
|
if x, ok := data.(templ.Component); ok {
|
|
return layout(x).Render(c.Request().Context(), w)
|
|
}
|
|
|
|
return fmt.Errorf("invalid data")
|
|
}
|