Passed
Pull Request — main (#166)
by Yume
02:23
created

app/v2/views/layout/base.layout_templ.go   A

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 18
eloc 61
dl 0
loc 82
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
F layout.Base 0 71 18
1
// Code generated by templ - DO NOT EDIT.
2
3
// templ: version: v0.2.543
4
package layout
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
import "github.com/memnix/memnix-rest/app/v2/views/partials"
14
15
func Base(title, username string, fromProtected, isError bool, errMsgs, sucMsgs []string) templ.Component {
16
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
17
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
18
		if !templ_7745c5c3_IsBuffer {
19
			templ_7745c5c3_Buffer = templ.GetBuffer()
20
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
21
		}
22
		ctx = templ.InitializeContext(ctx)
23
		templ_7745c5c3_Var1 := templ.GetChildren(ctx)
24
		if templ_7745c5c3_Var1 == nil {
25
			templ_7745c5c3_Var1 = templ.NopComponent
26
		}
27
		ctx = templ.ClearChildren(ctx)
28
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\" data-theme=\"dark\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"Go/Echo+Templ+Htmx: Full stack application using Golang&#39;s Echo framework &amp; Templ templating language with user session management + CRUD to a SQLite database (To Do List) and HTMX in the frontend\"><script src=\"https://unpkg.com/[email protected]\"></script><meta name=\"google\" content=\"notranslate\"><link rel=\"stylesheet\" href=\"/style.css\"><title>")
29
		if templ_7745c5c3_Err != nil {
30
			return templ_7745c5c3_Err
31
		}
32
		var templ_7745c5c3_Var2 string
33
		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
34
		if templ_7745c5c3_Err != nil {
35
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/layout/base.layout.templ`, Line: 17, Col: 17}
36
		}
37
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
38
		if templ_7745c5c3_Err != nil {
39
			return templ_7745c5c3_Err
40
		}
41
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title><script src=\"/htmx.min.js\"></script><link rel=\"preconnect\" href=\"https://fonts.bunny.net\"><link href=\"https://fonts.bunny.net/css?family=nunito:500,600|syne:500,600\" rel=\"stylesheet\"></head><body class=\"sample-transition\" hx-boost=\"true\"><header>")
42
		if templ_7745c5c3_Err != nil {
43
			return templ_7745c5c3_Err
44
		}
45
		templ_7745c5c3_Err = partials.Navbar(username, fromProtected).Render(ctx, templ_7745c5c3_Buffer)
46
		if templ_7745c5c3_Err != nil {
47
			return templ_7745c5c3_Err
48
		}
49
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</header>")
50
		if templ_7745c5c3_Err != nil {
51
			return templ_7745c5c3_Err
52
		}
53
		var templ_7745c5c3_Var3 = []any{}
54
		templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var3...)
55
		if templ_7745c5c3_Err != nil {
56
			return templ_7745c5c3_Err
57
		}
58
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<main class=\"")
59
		if templ_7745c5c3_Err != nil {
60
			return templ_7745c5c3_Err
61
		}
62
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ.CSSClasses(templ_7745c5c3_Var3).String()))
63
		if templ_7745c5c3_Err != nil {
64
			return templ_7745c5c3_Err
65
		}
66
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
67
		if templ_7745c5c3_Err != nil {
68
			return templ_7745c5c3_Err
69
		}
70
		templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
71
		if templ_7745c5c3_Err != nil {
72
			return templ_7745c5c3_Err
73
		}
74
		templ_7745c5c3_Err = partials.FlashMessages(errMsgs, sucMsgs).Render(ctx, templ_7745c5c3_Buffer)
75
		if templ_7745c5c3_Err != nil {
76
			return templ_7745c5c3_Err
77
		}
78
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</main><footer></footer></body></html>")
79
		if templ_7745c5c3_Err != nil {
80
			return templ_7745c5c3_Err
81
		}
82
		if !templ_7745c5c3_IsBuffer {
83
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
84
		}
85
		return templ_7745c5c3_Err
86
	})
87
}
88