generated from ElnuDev/go-project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.8 KiB
81 lines
1.8 KiB
// Code generated by templ@v0.2.304 DO NOT EDIT.
|
|
|
|
package main
|
|
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
|
|
|
import "github.com/a-h/templ"
|
|
import "context"
|
|
import "io"
|
|
import "bytes"
|
|
|
|
// GoExpression
|
|
import "fmt"
|
|
|
|
func plural(singular, plural string, count uint) string {
|
|
if count == 1 {
|
|
return singular
|
|
} else {
|
|
return plural
|
|
}
|
|
}
|
|
|
|
func Click(clicks uint) templ.Component {
|
|
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
|
|
templBuffer, templIsBuffer := w.(*bytes.Buffer)
|
|
if !templIsBuffer {
|
|
templBuffer = templ.GetBuffer()
|
|
defer templ.ReleaseBuffer(templBuffer)
|
|
}
|
|
ctx = templ.InitializeContext(ctx)
|
|
var_1 := templ.GetChildren(ctx)
|
|
if var_1 == nil {
|
|
var_1 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
// Element (standard)
|
|
_, err = templBuffer.WriteString("<div>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Text
|
|
var_2 := `The button has been clicked `
|
|
_, err = templBuffer.WriteString(var_2)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// StringExpression
|
|
var var_3 string = fmt.Sprintf("%d", clicks)
|
|
_, err = templBuffer.WriteString(templ.EscapeString(var_3))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// StringExpression
|
|
var var_4 string = " "
|
|
_, err = templBuffer.WriteString(templ.EscapeString(var_4))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// StringExpression
|
|
var var_5 string = plural("time", "times", clicks)
|
|
_, err = templBuffer.WriteString(templ.EscapeString(var_5))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Text
|
|
var_6 := `.`
|
|
_, err = templBuffer.WriteString(var_6)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString("</div>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !templIsBuffer {
|
|
_, err = io.Copy(w, templBuffer)
|
|
}
|
|
return err
|
|
})
|
|
}
|