Passed
Push — main ( d5abf3...ddf91d )
by Yume
04:43 queued 02:59
created

components.EmailError   B

Complexity

Conditions 6

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 17
nop 1
dl 0
loc 21
rs 8.6166
c 0
b 0
f 0
1
// Code generated by templ - DO NOT EDIT.
2
3
// templ: version: v0.2.663
4
package components
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 LoginComponent() 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 data-testid=\"loginComponent\"><form hx-post=\"/login\" hx-swap=\"beforeend\"><fieldset><label id=\"email\">Email <input name=\"email\" type=\"email\" placeholder=\"Email\" autocomplete=\"email\" required> <small id=\"invalid-helper\"></small></label> <label id=\"password\">Password <input type=\"password\" name=\"password\" placeholder=\"Password\"></label></fieldset><input type=\"submit\" hx-disabled-elt=\"this\" type=\"post\" value=\"Login\"></form></div>")
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
	})
35
}
36
37
func EmailError(err string) templ.Component {
38
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
39
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
40
		if !templ_7745c5c3_IsBuffer {
41
			templ_7745c5c3_Buffer = templ.GetBuffer()
42
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
43
		}
44
		ctx = templ.InitializeContext(ctx)
45
		templ_7745c5c3_Var2 := templ.GetChildren(ctx)
46
		if templ_7745c5c3_Var2 == nil {
47
			templ_7745c5c3_Var2 = templ.NopComponent
48
		}
49
		ctx = templ.ClearChildren(ctx)
50
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<label id=\"email\" hx-swap-oob=\"true\">Email <input name=\"email\" type=\"email\" placeholder=\"Email\" autocomplete=\"email\" aria-invalid=\"true\" aria-describedby=\"invalid-helper\" required> <small id=\"invalid-helper\">Maybe it's not the right email ?</small></label>")
51
		if templ_7745c5c3_Err != nil {
52
			return templ_7745c5c3_Err
53
		}
54
		if !templ_7745c5c3_IsBuffer {
55
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
56
		}
57
		return templ_7745c5c3_Err
58
	})
59
}
60
61
func PasswordError(err string) templ.Component {
62
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
63
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
64
		if !templ_7745c5c3_IsBuffer {
65
			templ_7745c5c3_Buffer = templ.GetBuffer()
66
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
67
		}
68
		ctx = templ.InitializeContext(ctx)
69
		templ_7745c5c3_Var3 := templ.GetChildren(ctx)
70
		if templ_7745c5c3_Var3 == nil {
71
			templ_7745c5c3_Var3 = templ.NopComponent
72
		}
73
		ctx = templ.ClearChildren(ctx)
74
		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<label id=\"password\" hx-swap-oob=\"true\">Password <input type=\"password\" name=\"password\" placeholder=\"Password\" aria-invalid=\"true\" aria-describedby=\"invalid-helper\"> <small id=\"invalid-helper\">Doesn't look like the right password to me...</small></label>")
75
		if templ_7745c5c3_Err != nil {
76
			return templ_7745c5c3_Err
77
		}
78
		if !templ_7745c5c3_IsBuffer {
79
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
80
		}
81
		return templ_7745c5c3_Err
82
	})
83
}
84
85
func LoginError(err string) templ.Component {
86
	return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
87
		templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
88
		if !templ_7745c5c3_IsBuffer {
89
			templ_7745c5c3_Buffer = templ.GetBuffer()
90
			defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
91
		}
92
		ctx = templ.InitializeContext(ctx)
93
		templ_7745c5c3_Var4 := templ.GetChildren(ctx)
94
		if templ_7745c5c3_Var4 == nil {
95
			templ_7745c5c3_Var4 = templ.NopComponent
96
		}
97
		ctx = templ.ClearChildren(ctx)
98
		templ_7745c5c3_Err = EmailError(err).Render(ctx, templ_7745c5c3_Buffer)
99
		if templ_7745c5c3_Err != nil {
100
			return templ_7745c5c3_Err
101
		}
102
		templ_7745c5c3_Err = PasswordError(err).Render(ctx, templ_7745c5c3_Buffer)
103
		if templ_7745c5c3_Err != nil {
104
			return templ_7745c5c3_Err
105
		}
106
		if !templ_7745c5c3_IsBuffer {
107
			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
108
		}
109
		return templ_7745c5c3_Err
110
	})
111
}
112