godash/components/system/system.templ

24 lines
775 B
Text
Raw Normal View History

2024-03-12 16:16:49 +01:00
package system
2024-03-12 15:49:08 +01:00
import "html/template"
2024-03-12 16:16:49 +01:00
var BarTemplate = template.Must(template.New("bar").Parse("<div id=\"{{ .Id }}\" class=\"progress-bar\" style=\"width: {{ .Percentage }}%\"></div>"))
2024-03-12 15:49:08 +01:00
type Bar struct {
Id string
Percentage float64
}
templ System(icon string, infoPre string, infoPost string, extraInfo string, percentageId string, valueId string, percentage float64) {
<div class="flex items-center">
<span class={ "system-icon", icon }></span>
<div class="w-full truncate">
<div class="extra-info">{ extraInfo }</div>
<div class="truncate"><span id={ valueId }>{ infoPre }</span>{ infoPost }</div>
<div class="progress-bar-wrapper">
2024-03-12 16:16:49 +01:00
@templ.FromGoHTML(BarTemplate, Bar{Id:percentageId, Percentage:percentage})
2024-03-12 15:49:08 +01:00
</div>
</div>
</div>
}