mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
* feat: add support for DID number as primary key for Controllers * refactor: rename pkg/proxy to app/proxy * feat: add vault module keeper tests * feat(vault): add DID keeper to vault module * refactor: move vault client code to its own package * refactor(vault): extract schema definition * refactor: use vaulttypes for MsgAllocateVault * refactor: update vault assembly logic to use new methods * feat: add dwn-proxy command * refactor: remove unused context.go file * refactor: remove unused web-related code * feat: add DWN proxy server * feat: add BuildTx RPC to vault module * fix: Implement BuildTx endpoint * feat: add devbox integration to project
48 lines
896 B
Go
48 lines
896 B
Go
package blocks
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
type Icon interface {
|
|
Render() templ.Component
|
|
}
|
|
|
|
type Variant interface {
|
|
Attributes() templ.Attributes
|
|
}
|
|
|
|
func clsxMerge(variants ...Variant) templ.Attributes {
|
|
combinedAttrs := templ.Attributes{}
|
|
var classElements []string
|
|
|
|
for _, variant := range variants {
|
|
attrs := variant.Attributes()
|
|
if class, ok := attrs["class"].(string); ok {
|
|
classElements = append(classElements, strings.Fields(class)...)
|
|
}
|
|
for key, value := range attrs {
|
|
if key != "class" {
|
|
combinedAttrs[key] = value
|
|
}
|
|
}
|
|
}
|
|
|
|
if len(classElements) > 0 {
|
|
combinedAttrs["class"] = strings.Join(classElements, " ")
|
|
}
|
|
return combinedAttrs
|
|
}
|
|
|
|
func clsxBuilder(classes ...string) templ.Attributes {
|
|
if len(classes) == 0 {
|
|
return templ.Attributes{}
|
|
}
|
|
class := strings.Join(classes, " ")
|
|
return templ.Attributes{
|
|
"class": class,
|
|
}
|
|
}
|