mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-19 02:11:51 +01:00
26 lines
451 B
Go
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 ""
|
|
}
|