// Code generated by templ@(devel) DO NOT EDIT. package clicktoload //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" "examples/shared" ) func demo(users []user, page int) 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("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Text var_2 := `Name` _, err = templBuffer.WriteString(var_2) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Text var_3 := `Email` _, err = templBuffer.WriteString(var_3) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Text var_4 := `ID` _, err = templBuffer.WriteString(var_4) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // TemplElement err = tbody(users, page).Render(ctx, templBuffer) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } if !templIsBuffer { _, err = io.Copy(w, templBuffer) } return err }) } func tbody(users []user, page int) 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_5 := templ.GetChildren(ctx) if var_5 == nil { var_5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) // For for _, u := range users { // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // StringExpression var var_6 string = u.name _, err = templBuffer.WriteString(templ.EscapeString(var_6)) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // StringExpression var var_7 string = u.email _, err = templBuffer.WriteString(templ.EscapeString(var_7)) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // StringExpression var var_8 string = u.id _, err = templBuffer.WriteString(templ.EscapeString(var_8)) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } } // TemplElement err = replaceMe(page).Render(ctx, templBuffer) if err != nil { return err } if !templIsBuffer { _, err = io.Copy(w, templBuffer) } return err }) } func replaceMe(page int) 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_9 := templ.GetChildren(ctx) if var_9 == nil { var_9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Text var_10 := `Load More Agents...` _, err = templBuffer.WriteString(var_10) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } if !templIsBuffer { _, err = io.Copy(w, templBuffer) } return err }) } func Index(users []user) 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_11 := templ.GetChildren(ctx) if var_11 == nil { var_11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) // TemplElement var_12 := 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("") if err != nil { return err } // Text var_13 := `Click to Load` _, err = templBuffer.WriteString(var_13) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Whitespace (normalised) _, err = templBuffer.WriteString(` `) if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("

") if err != nil { return err } // Text var_14 := `This example shows how to implement click-to-load the next page in a table of data. The crux of the demo is the final row:` _, err = templBuffer.WriteString(var_14) if err != nil { return err } _, err = templBuffer.WriteString("

") if err != nil { return err } // Whitespace (normalised) _, err = templBuffer.WriteString(` `) if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("
")
			if err != nil {
				return err
			}
			// Element (standard)
			_, err = templBuffer.WriteString("")
			if err != nil {
				return err
			}
			// TemplElement
			var_15 := 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)
				}
				// TemplElement
				err = replaceMe(1).Render(ctx, templBuffer)
				if err != nil {
					return err
				}
				if !templIsBuffer {
					_, err = io.Copy(w, templBuffer)
				}
				return err
			})
			err = shared.Raw().Render(templ.WithChildren(ctx, var_15), templBuffer)
			if err != nil {
				return err
			}
			_, err = templBuffer.WriteString("")
			if err != nil {
				return err
			}
			_, err = templBuffer.WriteString("
") if err != nil { return err } // Whitespace (normalised) _, err = templBuffer.WriteString(` `) if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("

") if err != nil { return err } // Text var_16 := `This row contains a button that will replace the entire row with the next page of results (which will contain a button to load the next page of results). And so on.` _, err = templBuffer.WriteString(var_16) if err != nil { return err } _, err = templBuffer.WriteString("

") if err != nil { return err } // Whitespace (normalised) _, err = templBuffer.WriteString(` `) if err != nil { return err } // Element (standard) _, err = templBuffer.WriteString("") if err != nil { return err } // Text var_17 := `Demo` _, err = templBuffer.WriteString(var_17) if err != nil { return err } _, err = templBuffer.WriteString("") if err != nil { return err } // Whitespace (normalised) _, err = templBuffer.WriteString(` `) if err != nil { return err } // TemplElement err = demo(users, 1).Render(ctx, templBuffer) if err != nil { return err } if !templIsBuffer { _, err = io.Copy(w, templBuffer) } return err }) err = shared.Layout("Click to Load").Render(templ.WithChildren(ctx, var_12), templBuffer) if err != nil { return err } if !templIsBuffer { _, err = io.Copy(w, templBuffer) } return err }) }