package blocks import "strings" type Icon interface { Render() templ.Component } type Variant interface { Attributes() templ.Attributes } var stylesHandle = templ.NewOnceHandle() var alpineHandle = templ.NewOnceHandle() var htmxHandle = templ.NewOnceHandle() 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, } } templ Spacer() {
} templ Styles(local bool) { @stylesHandle.Once() { } } templ Alpine(local bool) { @alpineHandle.Once() { } } templ Htmx(local bool) { @htmxHandle.Once() { } } templ Rows() {
{ children... }
} templ Columns() {
{ children... }
} css main() { font-family: R-Flex, system-ui, Avenir, Helvetica, Arial, sans-serif; }