0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-12-18 21:52:48 +01:00
gitea/components/sort_option.go
2025-05-27 20:25:07 -07:00

22 lines
403 B
Go

package components
import (
"fmt"
"net/url"
g "maragu.dev/gomponents"
gh "maragu.dev/gomponents/html"
)
func SortOption(data ExploreUsersPageProps, sortType, label string) g.Node {
active := ""
if data.SortType == sortType {
active = "active "
}
return gh.A(
gh.Class(active+"item"),
gh.Href(fmt.Sprintf("?sort=%s&q=%s", sortType, url.QueryEscape(data.Keyword))),
g.Text(label),
)
}