github.com/10ego/gthp@v0.0.0-20241025155251-e1514fa71fbb/internal/templ/templates/index_templ.go (about)

     1  // Code generated by templ - DO NOT EDIT.
     2  
     3  // templ: version: v0.2.778
     4  package templates
     5  
     6  //lint:file-ignore SA4006 This context is only used if a nested component is present.
     7  
     8  import "github.com/a-h/templ"
     9  import templruntime "github.com/a-h/templ/runtime"
    10  
    11  func Index(title string) templ.Component {
    12  	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
    13  		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
    14  		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
    15  			return templ_7745c5c3_CtxErr
    16  		}
    17  		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
    18  		if !templ_7745c5c3_IsBuffer {
    19  			defer func() {
    20  				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
    21  				if templ_7745c5c3_Err == nil {
    22  					templ_7745c5c3_Err = templ_7745c5c3_BufErr
    23  				}
    24  			}()
    25  		}
    26  		ctx = templ.InitializeContext(ctx)
    27  		templ_7745c5c3_Var1 := templ.GetChildren(ctx)
    28  		if templ_7745c5c3_Var1 == nil {
    29  			templ_7745c5c3_Var1 = templ.NopComponent
    30  		}
    31  		ctx = templ.ClearChildren(ctx)
    32  		templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
    33  			templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
    34  			templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
    35  			if !templ_7745c5c3_IsBuffer {
    36  				defer func() {
    37  					templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
    38  					if templ_7745c5c3_Err == nil {
    39  						templ_7745c5c3_Err = templ_7745c5c3_BufErr
    40  					}
    41  				}()
    42  			}
    43  			ctx = templ.InitializeContext(ctx)
    44  			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"bg-white shadow rounded-lg p-6\"><h1 class=\"text-3xl font-bold mb-4\">")
    45  			if templ_7745c5c3_Err != nil {
    46  				return templ_7745c5c3_Err
    47  			}
    48  			var templ_7745c5c3_Var3 string
    49  			templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title)
    50  			if templ_7745c5c3_Err != nil {
    51  				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templ/templates/index.templ`, Line: 6, Col: 46}
    52  			}
    53  			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
    54  			if templ_7745c5c3_Err != nil {
    55  				return templ_7745c5c3_Err
    56  			}
    57  			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h1><div hx-target=\"this\" hx-swap=\"outerHTML\"><button hx-post=\"/api/data\" class=\"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline\">Load Data</button></div></div>")
    58  			if templ_7745c5c3_Err != nil {
    59  				return templ_7745c5c3_Err
    60  			}
    61  			return templ_7745c5c3_Err
    62  		})
    63  		templ_7745c5c3_Err = Layout("Home").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
    64  		if templ_7745c5c3_Err != nil {
    65  			return templ_7745c5c3_Err
    66  		}
    67  		return templ_7745c5c3_Err
    68  	})
    69  }
    70  
    71  var _ = templruntime.GeneratedTemplate