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

views.Page   B

Complexity

Conditions 8

Size

Total Lines 29
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 23
nop 1
dl 0
loc 29
rs 7.3333
c 0
b 0
f 0
1
// Code generated by templ - DO NOT EDIT.
2
3
// templ: version: v0.2.543
4
package views
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 hello(name string) 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("<div class=\"flex flex-col\"><h1 class=\"mx-auto \">Hello, ")
27
		if templ_7745c5c3_Err != nil {
28
			return templ_7745c5c3_Err
29
		}
30
		var templ_7745c5c3_Var2 string
31
		templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)
32
		if templ_7745c5c3_Err != nil {
33
			return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/index.templ`, Line: 6, Col: 36}
34
		}
35
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
36
		if templ_7745c5c3_Err != nil {
37
			return templ_7745c5c3_Err
38
		}
39
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" !</h1><h2 class=\"mx-auto \">Banana ! </h2><button hx-post=\"/clicked\" hx-trigger=\"click\" hx-swap=\"outerHTML\">Click Me!</button></div>")
40
		if templ_7745c5c3_Err != nil {
41
			return templ_7745c5c3_Err
42
		}
43
		if !templ_7745c5c3_IsBuffer {
44
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
45
		}
46
		return templ_7745c5c3_Err
47
	})
48
}
49
50
func Clicked() templ.Component {
51
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
52
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
53
		if !templ_7745c5c3_IsBuffer {
54
			templ_7745c5c3_Buffer = templ.GetBuffer()
55
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
56
		}
57
		ctx = templ.InitializeContext(ctx)
58
		templ_7745c5c3_Var3 := templ.GetChildren(ctx)
59
		if templ_7745c5c3_Var3 == nil {
60
			templ_7745c5c3_Var3 = templ.NopComponent
61
		}
62
		ctx = templ.ClearChildren(ctx)
63
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"parent-div\" class=\"flex flex-col\"><h1 class=\"mx-auto \">Clicked!</h1></div>")
64
		if templ_7745c5c3_Err != nil {
65
			return templ_7745c5c3_Err
66
		}
67
		if !templ_7745c5c3_IsBuffer {
68
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
69
		}
70
		return templ_7745c5c3_Err
71
	})
72
}
73
74
func Page(name string) templ.Component {
75
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
76
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
77
		if !templ_7745c5c3_IsBuffer {
78
			templ_7745c5c3_Buffer = templ.GetBuffer()
79
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
80
		}
81
		ctx = templ.InitializeContext(ctx)
82
		templ_7745c5c3_Var4 := templ.GetChildren(ctx)
83
		if templ_7745c5c3_Var4 == nil {
84
			templ_7745c5c3_Var4 = templ.NopComponent
85
		}
86
		ctx = templ.ClearChildren(ctx)
87
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<html><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Index</title><link rel=\"stylesheet\" href=\"/style.css\"><script src=\"/htmx.min.js\"></script></head><body><section class=\"mx-auto max-w-6xl px-4 pt-[72px] sm:px-6 md:flex md:h-screen md:min-h-[calc(100vh-72px)] 2xl:h-auto\"><div class=\"block py-12 text-center md:flex md:py-12 md:text-left lg:py-16\"><div class=\"mx-auto flex basis-3/5 items-center pb-12 md:py-0 md:pr-16\"><div><h1 class=\"leading-tighter font-heading mb-4 px-4 text-5xl font-bold tracking-tighter md:px-0 md:text-[3.48rem]\">A <span class=\"text-accent\">spaced repetition </span> <span class=\"lg:block\">learning app </span> <span class=\"text-secondary sm:whitespace-nowrap\">using AI</span></h1><div class=\"mx-auto max-w-3xl\"><div class=\"m-auto flex max-w-xs flex-col flex-nowrap justify-center gap-4 sm:max-w-md sm:flex-row md:m-0 md:justify-start\"><div class=\"flex w-full sm:w-auto\"><a class=\"btn btn-primary w-full sm:mb-0\" to=\"/auth\" rel=\"noopener\">cta.get_started</a></div><div class=\"flex w-full sm:w-auto\"><a to=\"https://github.com/CorentinGS\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"btn btn-outline w-full\">cta.learn_more</a></div></div></div></div></div><div class=\"block flex-1 items-center md:flex\"><div class=\"relative m-auto max-w-4xl\">")
88
		if templ_7745c5c3_Err != nil {
89
			return templ_7745c5c3_Err
90
		}
91
		templ_7745c5c3_Err = hello(name).Render(ctx, templ_7745c5c3_Buffer)
92
		if templ_7745c5c3_Err != nil {
93
			return templ_7745c5c3_Err
94
		}
95
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></section></body></html>")
96
		if templ_7745c5c3_Err != nil {
97
			return templ_7745c5c3_Err
98
		}
99
		if !templ_7745c5c3_IsBuffer {
100
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
101
		}
102
		return templ_7745c5c3_Err
103
	})
104
}
105