213 lines
4.7 KiB
Go
213 lines
4.7 KiB
Go
// Code generated by templ@(devel) DO NOT EDIT.
|
|
|
|
package lazyload
|
|
|
|
//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 "examples/shared"
|
|
|
|
func demo() 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)
|
|
// RawElement
|
|
_, err = templBuffer.WriteString("<style>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Text
|
|
var_2 := `
|
|
.htmx-settling img {
|
|
opacity: 0;
|
|
}
|
|
img {
|
|
transition: opacity 300ms ease-in;
|
|
}
|
|
`
|
|
_, err = templBuffer.WriteString(var_2)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString("</style>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element (standard)
|
|
_, err = templBuffer.WriteString("<div")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element Attributes
|
|
_, err = templBuffer.WriteString(" hx-get=\"/lazy-loading/graph\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(" hx-trigger=\"load\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(">")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element (void)
|
|
_, err = templBuffer.WriteString("<img")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element Attributes
|
|
_, err = templBuffer.WriteString(" alt=\"Result loading...\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(" class=\"htmx-indicator\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(" width=\"150\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(" src=\"/lazy-loading/bars.svg\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(">")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString("</div>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !templIsBuffer {
|
|
_, err = io.Copy(w, templBuffer)
|
|
}
|
|
return err
|
|
})
|
|
}
|
|
|
|
func graphImage() 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_3 := templ.GetChildren(ctx)
|
|
if var_3 == nil {
|
|
var_3 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
// Element (void)
|
|
_, err = templBuffer.WriteString("<img")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element Attributes
|
|
_, err = templBuffer.WriteString(" alt=\"Tokyo Climate\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(" src=\"/lazy-loading/tokyo.png\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(">")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !templIsBuffer {
|
|
_, err = io.Copy(w, templBuffer)
|
|
}
|
|
return err
|
|
})
|
|
}
|
|
|
|
func Index() 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_4 := templ.GetChildren(ctx)
|
|
if var_4 == nil {
|
|
var_4 = templ.NopComponent
|
|
}
|
|
ctx = templ.ClearChildren(ctx)
|
|
// TemplElement
|
|
var_5 := 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)
|
|
}
|
|
// Element (standard)
|
|
_, err = templBuffer.WriteString("<h2")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Element Attributes
|
|
_, err = templBuffer.WriteString(" class=\"title\"")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString(">")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Text
|
|
var_6 := `Lazy Loading`
|
|
_, err = templBuffer.WriteString(var_6)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = templBuffer.WriteString("</h2>")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Whitespace (normalised)
|
|
_, err = templBuffer.WriteString(` `)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// TemplElement
|
|
err = demo().Render(ctx, templBuffer)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !templIsBuffer {
|
|
_, err = io.Copy(w, templBuffer)
|
|
}
|
|
return err
|
|
})
|
|
err = shared.Layout("Lazy Loading").Render(templ.WithChildren(ctx, var_5), templBuffer)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !templIsBuffer {
|
|
_, err = io.Copy(w, templBuffer)
|
|
}
|
|
return err
|
|
})
|
|
}
|
|
|