An experimental IndieWeb site built in Go.
at main 69 lines 2.4 kB view raw
1// Code generated by templ - DO NOT EDIT. 2 3// templ: version: v0.2.747 4package pages 5 6//lint:file-ignore SA4006 This context is only used if a nested component is present. 7 8import "github.com/a-h/templ" 9import templruntime "github.com/a-h/templ/runtime" 10 11import ( 12 p "github.com/puregarlic/space/html/components/posts" 13 "github.com/puregarlic/space/models" 14) 15 16func Home(posts []*models.Post) templ.Component { 17 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { 18 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context 19 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) 20 if !templ_7745c5c3_IsBuffer { 21 defer func() { 22 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) 23 if templ_7745c5c3_Err == nil { 24 templ_7745c5c3_Err = templ_7745c5c3_BufErr 25 } 26 }() 27 } 28 ctx = templ.InitializeContext(ctx) 29 templ_7745c5c3_Var1 := templ.GetChildren(ctx) 30 if templ_7745c5c3_Var1 == nil { 31 templ_7745c5c3_Var1 = templ.NopComponent 32 } 33 ctx = templ.ClearChildren(ctx) 34 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<ul class=\"flex flex-col gap-6\">") 35 if templ_7745c5c3_Err != nil { 36 return templ_7745c5c3_Err 37 } 38 if len(posts) > 0 { 39 for _, post := range posts { 40 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li class=\"flex flex-col\">") 41 if templ_7745c5c3_Err != nil { 42 return templ_7745c5c3_Err 43 } 44 templ_7745c5c3_Err = p.PostFeedHeader(post).Render(ctx, templ_7745c5c3_Buffer) 45 if templ_7745c5c3_Err != nil { 46 return templ_7745c5c3_Err 47 } 48 templ_7745c5c3_Err = p.PostContent(post).Render(ctx, templ_7745c5c3_Buffer) 49 if templ_7745c5c3_Err != nil { 50 return templ_7745c5c3_Err 51 } 52 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</li>") 53 if templ_7745c5c3_Err != nil { 54 return templ_7745c5c3_Err 55 } 56 } 57 } else { 58 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li class=\"text-muted bg-surface px-4 py-8 text-center border border-overlay\">intention-rich, content-poor</li>") 59 if templ_7745c5c3_Err != nil { 60 return templ_7745c5c3_Err 61 } 62 } 63 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul>") 64 if templ_7745c5c3_Err != nil { 65 return templ_7745c5c3_Err 66 } 67 return templ_7745c5c3_Err 68 }) 69}