0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-08 12:34:45 +01:00
gitea/components/components.go
2025-05-27 21:07:21 -07:00

29 lines
542 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
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 ""
}