95 lines
2.1 KiB
Plaintext
95 lines
2.1 KiB
Plaintext
|
|
// Code generated by wa-generator. DO NOT EDIT.
|
||
|
|
// Source: Web Awesome wa-divider
|
||
|
|
|
||
|
|
package wa
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/a-h/templ"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Dividers are used to visually separate or group elements.
|
||
|
|
//
|
||
|
|
// Web Awesome component: <wa-divider>
|
||
|
|
|
||
|
|
// DividerProps holds all properties for the wa-divider component
|
||
|
|
type DividerProps struct {
|
||
|
|
// Sets the divider's orientation.
|
||
|
|
// Valid values: "horizontal", "vertical"
|
||
|
|
Orientation string `attr:"orientation"`
|
||
|
|
|
||
|
|
// Events
|
||
|
|
|
||
|
|
// Slots contains named slot content
|
||
|
|
Slots DividerSlots
|
||
|
|
|
||
|
|
// Attrs contains additional HTML attributes
|
||
|
|
Attrs templ.Attributes
|
||
|
|
}
|
||
|
|
|
||
|
|
// DividerBuilder provides a fluent API for constructing DividerProps
|
||
|
|
type DividerBuilder struct {
|
||
|
|
props DividerProps
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewDivider creates a new builder for wa-divider
|
||
|
|
func NewDivider() *DividerBuilder {
|
||
|
|
return &DividerBuilder{}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Orientation sets the orientation attribute
|
||
|
|
// Sets the divider's orientation.
|
||
|
|
func (b *DividerBuilder) Orientation(v string) *DividerBuilder {
|
||
|
|
b.props.Orientation = v
|
||
|
|
return b
|
||
|
|
}
|
||
|
|
|
||
|
|
// Attr adds a custom HTML attribute
|
||
|
|
func (b *DividerBuilder) Attr(name, value string) *DividerBuilder {
|
||
|
|
if b.props.Attrs == nil {
|
||
|
|
b.props.Attrs = templ.Attributes{}
|
||
|
|
}
|
||
|
|
b.props.Attrs[name] = value
|
||
|
|
return b
|
||
|
|
}
|
||
|
|
|
||
|
|
// Attrs merges multiple attributes
|
||
|
|
func (b *DividerBuilder) Attrs(attrs templ.Attributes) *DividerBuilder {
|
||
|
|
if b.props.Attrs == nil {
|
||
|
|
b.props.Attrs = templ.Attributes{}
|
||
|
|
}
|
||
|
|
for k, v := range attrs {
|
||
|
|
b.props.Attrs[k] = v
|
||
|
|
}
|
||
|
|
return b
|
||
|
|
}
|
||
|
|
|
||
|
|
// Props returns the built properties
|
||
|
|
func (b *DividerBuilder) Props() DividerProps {
|
||
|
|
return b.props
|
||
|
|
}
|
||
|
|
|
||
|
|
// Build returns the props (alias for Props for semantic clarity)
|
||
|
|
func (b *DividerBuilder) Build() DividerProps {
|
||
|
|
return b.props
|
||
|
|
}
|
||
|
|
|
||
|
|
// Divider renders the wa-divider component
|
||
|
|
templ Divider(props DividerProps) {
|
||
|
|
<wa-divider
|
||
|
|
if props.Orientation != "" {
|
||
|
|
orientation={ props.Orientation }
|
||
|
|
}
|
||
|
|
{ props.Attrs... }
|
||
|
|
>
|
||
|
|
{ children... }
|
||
|
|
</wa-divider>
|
||
|
|
}
|
||
|
|
|
||
|
|
// DividerFunc renders with a builder function for inline configuration
|
||
|
|
templ DividerFunc(fn func(*DividerBuilder)) {
|
||
|
|
{{ b := NewDivider(); fn(b) }}
|
||
|
|
@Divider(b.Props()) {
|
||
|
|
{ children... }
|
||
|
|
}
|
||
|
|
}
|