0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-12-19 02:11:51 +01:00
gitea/components/components.go
Philip Peterson e984f30bc1 Cleanup
2025-05-27 20:55:30 -07:00

26 lines
451 B
Go

package components
import (
"code.gitea.io/gitea/modules/svg"
g "maragu.dev/gomponents"
)
func If(condition bool, node g.Node) g.Node {
if condition {
return node
}
return nil
}
func SVG(icon string, others ...any) g.Node {
return g.Raw(string(svg.RenderHTML(icon)))
}
// Utility to add "active" class if condition is true
func classIf(condition bool, class string) string { //nolint:unparam
if condition {
return class
}
return ""
}