package handler

import (
	"html/template"
	"io"
	"log"
)

type Templates struct {
	tmpl *template.Template
}

func NewTemplates(tmpl *template.Template) *Templates {
	return &Templates{tmpl: tmpl}
}
func (t *Templates) Render(w io.Writer, name string, data any) {
	if err := t.tmpl.ExecuteTemplate(w, name+".html", data); err != nil {
		log.Printf("template error: %s: %v", name, err)
	}
}
