0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-12-19 23:43:11 +01:00
gitea/components/components.go
2025-05-27 20:25:07 -07:00

26 lines
434 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 {
if condition {
return class
}
return ""
}