github.com/ngsalvo/datastar-rick-and-morty@v0.0.0-20250318143428-01c52f047cfc/web/layouts/page_templ.go (about)

     1  // Code generated by templ - DO NOT EDIT.
     2  
     3  // templ: version: v0.3.819
     4  package layouts
     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 head(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_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/starfederation/datastar/bundles/datastar.js\"></script><title>")
    33  		if templ_7745c5c3_Err != nil {
    34  			return templ_7745c5c3_Err
    35  		}
    36  		var templ_7745c5c3_Var2 string
    37  		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
    38  		if templ_7745c5c3_Err != nil {
    39  			return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/page.templ`, Line: 8, Col: 16}
    40  		}
    41  		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
    42  		if templ_7745c5c3_Err != nil {
    43  			return templ_7745c5c3_Err
    44  		}
    45  		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</title><link rel=\"shortcut icon\" href=\"static/images/favicon.ico\" type=\"image/x-icon\"><link rel=\"stylesheet\" href=\"/static/styles/styles.css\" type=\"text/css\"><link rel=\"preconnect\" href=\"https://fonts.googleapi.com\"><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin></head>")
    46  		if templ_7745c5c3_Err != nil {
    47  			return templ_7745c5c3_Err
    48  		}
    49  		return nil
    50  	})
    51  }
    52  
    53  func Page(title string) templ.Component {
    54  	return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
    55  		templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
    56  		if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
    57  			return templ_7745c5c3_CtxErr
    58  		}
    59  		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
    60  		if !templ_7745c5c3_IsBuffer {
    61  			defer func() {
    62  				templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
    63  				if templ_7745c5c3_Err == nil {
    64  					templ_7745c5c3_Err = templ_7745c5c3_BufErr
    65  				}
    66  			}()
    67  		}
    68  		ctx = templ.InitializeContext(ctx)
    69  		templ_7745c5c3_Var3 := templ.GetChildren(ctx)
    70  		if templ_7745c5c3_Var3 == nil {
    71  			templ_7745c5c3_Var3 = templ.NopComponent
    72  		}
    73  		ctx = templ.ClearChildren(ctx)
    74  		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<!doctype html><html lang=\"en\" class=\"h-screen max-h-screen bg-ctp-base\">")
    75  		if templ_7745c5c3_Err != nil {
    76  			return templ_7745c5c3_Err
    77  		}
    78  		templ_7745c5c3_Err = head(title).Render(ctx, templ_7745c5c3_Buffer)
    79  		if templ_7745c5c3_Err != nil {
    80  			return templ_7745c5c3_Err
    81  		}
    82  		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<body class=\"h-screen isolate bg-background text-text\"><div class=\"w-full h-full overflow-y-scroll\"><main>")
    83  		if templ_7745c5c3_Err != nil {
    84  			return templ_7745c5c3_Err
    85  		}
    86  		templ_7745c5c3_Err = templ_7745c5c3_Var3.Render(ctx, templ_7745c5c3_Buffer)
    87  		if templ_7745c5c3_Err != nil {
    88  			return templ_7745c5c3_Err
    89  		}
    90  		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</main></div><pre data-text=\"ctx.signals.JSON()\"></pre></body></html>")
    91  		if templ_7745c5c3_Err != nil {
    92  			return templ_7745c5c3_Err
    93  		}
    94  		return nil
    95  	})
    96  }
    97  
    98  var _ = templruntime.GeneratedTemplate