Big refactoring of PARCOURSMOB - Initial commit
This commit is contained in:
26
utils/icons/svg-icons.go
Normal file
26
utils/icons/svg-icons.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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))
|
||||
}
|
||||
Reference in New Issue
Block a user