| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | // Code generated by templ - DO NOT EDIT. |
||
| 4 | package partials |
||
| 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 "context" |
||
| 10 | import "io" |
||
| 11 | import "bytes" |
||
| 12 | |||
| 13 | func ImageOptimized(src, alt string, width, height int, class string, lazy bool, quality int) templ.Component { |
||
| 14 | return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { |
||
| 15 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) |
||
| 16 | if !templ_7745c5c3_IsBuffer { |
||
| 17 | templ_7745c5c3_Buffer = templ.GetBuffer() |
||
| 18 | defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) |
||
| 19 | } |
||
| 20 | ctx = templ.InitializeContext(ctx) |
||
| 21 | templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
||
| 22 | if templ_7745c5c3_Var1 == nil { |
||
| 23 | templ_7745c5c3_Var1 = templ.NopComponent |
||
| 24 | } |
||
| 25 | ctx = templ.ClearChildren(ctx) |
||
| 26 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<picture><source srcset=\"{src}.webp\" type=\"image/webp\" data-testid=\"webp\"> <img src=\"{src}\" alt=\"{alt}\" width=\"{width}\" height=\"{height}\" class=\"{class}\" loading=\"{if lazy}lazy{else}auto{end}\" decoding=\"async\" data-testid=\"src\"></picture>") |
||
| 27 | if templ_7745c5c3_Err != nil { |
||
| 28 | return templ_7745c5c3_Err |
||
| 29 | } |
||
| 30 | if !templ_7745c5c3_IsBuffer { |
||
| 31 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
||
| 32 | } |
||
| 33 | return templ_7745c5c3_Err |
||
| 34 | }) |
||
| 36 |