// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.924 // templui component spinner - version: main installed by templui v0.71.0 package spinner //lint:file-ignore SA4006 This context is only used if a nested component is present. import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import "git.jmbit.de/jmb/scanfile/server/web/templui/utils" type Size string const ( SizeSm Size = "sm" SizeMd Size = "md" SizeLg Size = "lg" ) type Props struct { ID string Class string Attributes templ.Attributes Size Size Color string } func Spinner(props ...Props) templ.Component { 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) if !templ_7745c5c3_IsBuffer { defer func() { templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) if templ_7745c5c3_Err == nil { templ_7745c5c3_Err = templ_7745c5c3_BufErr } }() } ctx = templ.InitializeContext(ctx) templ_7745c5c3_Var1 := templ.GetChildren(ctx) if templ_7745c5c3_Var1 == nil { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) var p Props if len(props) > 0 { p = props[0] } var templ_7745c5c3_Var2 = []any{utils.TwMerge( "inline-flex flex-col items-center justify-center", p.Class, ), } templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var5 = []any{utils.TwMerge( "animate-spin rounded-full", sizeClass(p.Size), borderSizeClass(p.Size), utils.IfElse( p.Color == "", "border-primary border-b-transparent", "border-current border-b-transparent", ), utils.IfElse( p.Color != "", p.Color, "", ), ), } templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var5...) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return nil }) } func sizeClass(size Size) string { switch size { case SizeSm: return "w-6 h-6" case SizeLg: return "w-12 h-12" default: return "w-8 h-8" } } func borderSizeClass(size Size) string { switch size { case SizeSm: return "border-[3px]" case SizeLg: return "border-[5px]" default: return "border-4" } } var _ = templruntime.GeneratedTemplate