parcoursmob/utils/icons/svg-icons.go

27 lines
375 B
Go

package icons
import (
"fmt"
"html/template"
)
type IconSet struct {
Icons map[string]string
}
func NewIconSet(set map[string]string) IconSet {
return IconSet{
Icons: set,
}
}
func (i IconSet) Icon(name string, classes string) template.HTML {
icon, ok := i.Icons[name]
if !ok {
return template.HTML("")
}
return template.HTML(fmt.Sprintf(icon, classes))
}