AnthoLume/ngtemplates/components/info_card_templ.go

154 lines
5.9 KiB
Go
Raw Normal View History

2024-10-06 21:01:37 +00:00
// Code generated by templ - DO NOT EDIT.
2025-01-25 20:01:18 +00:00
// templ: version: v0.3.819
2024-10-06 21:01:37 +00:00
package components
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
2025-01-25 20:01:18 +00:00
import templruntime "github.com/a-h/templ/runtime"
2024-10-06 21:01:37 +00:00
import (
"fmt"
)
func InfoCard(name string, metric int) templ.Component {
2025-01-25 20:01:18 +00:00
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2024-10-06 21:01:37 +00:00
if !templ_7745c5c3_IsBuffer {
2025-01-25 20:01:18 +00:00
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
2024-10-06 21:01:37 +00:00
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"w-full\">")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = infoCardInner(name, metric).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</div>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-06 21:01:37 +00:00
})
}
func InfoCardLink(name string, metric int, link string) templ.Component {
2025-01-25 20:01:18 +00:00
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2024-10-06 21:01:37 +00:00
if !templ_7745c5c3_IsBuffer {
2025-01-25 20:01:18 +00:00
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
2024-10-06 21:01:37 +00:00
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<a href=\"")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 templ.SafeURL = templ.SafeURL(link)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"w-full\">")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = infoCardInner(name, metric).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</a>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-06 21:01:37 +00:00
})
}
func infoCardInner(name string, metric int) templ.Component {
2025-01-25 20:01:18 +00:00
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
2024-10-06 21:01:37 +00:00
if !templ_7745c5c3_IsBuffer {
2025-01-25 20:01:18 +00:00
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
2024-10-06 21:01:37 +00:00
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<div class=\"flex gap-4 w-full p-4 bg-white shadow-lg dark:bg-gray-700 rounded\"><div class=\"flex flex-col justify-around dark:text-white w-full text-sm\"><p class=\"text-2xl font-bold text-black dark:text-white\">")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(metric))
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/info_card.templ`, Line: 22, Col: 80}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</p><p class=\"text-sm text-gray-400\">")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(name)
if templ_7745c5c3_Err != nil {
2025-01-25 20:01:18 +00:00
return templ.Error{Err: templ_7745c5c3_Err, FileName: `ngtemplates/components/info_card.templ`, Line: 23, Col: 42}
2024-10-06 21:01:37 +00:00
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</p></div></div>")
2024-10-06 21:01:37 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-25 20:01:18 +00:00
return nil
2024-10-06 21:01:37 +00:00
})
}
2025-01-25 20:01:18 +00:00
var _ = templruntime.GeneratedTemplate