Move elements and attributes into html package (#52) This makes it easier to use dot-imports. Also updated the readme and examples with new usage, and move the `Classes` helper into the `components` package.
1 file changed, 3 insertions(+), 4 deletions(-)
changed files
M attr/attributes.go → components/attributes.go
@@ -1,6 +1,4 @@ -// Package attr provides shortcuts and helpers to common HTML attributes. -// See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes for a list of attributes. -package attr +package components import ( "io"@@ -8,6 +6,7 @@ "sort" "strings" g "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/html" ) // Classes is a map of strings to booleans, which Renders to an attribute with name "class".@@ -23,7 +22,7 @@ included = append(included, c) } } sort.Strings(included) - return g.Attr("class", strings.Join(included, " ")).Render(w) + return html.Class(strings.Join(included, " ")).Render(w) } func (c Classes) Type() g.NodeType {