-
Notifications
You must be signed in to change notification settings - Fork 0
/
help_dialog_templ.go
100 lines (93 loc) · 2.45 KB
/
help_dialog_templ.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Code generated by templ@v0.2.334 DO NOT EDIT.
package components
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import "context"
import "io"
import "bytes"
import "github.com/ItsNotGoodName/smtpbridge/web/icons"
type HelpDialogProps struct {
ID string
Size string
}
func (h HelpDialogProps) ShowModal() templ.ComponentScript {
return templ.ComponentScript{Call: h.ID + ".showModal()"}
}
func HelpDialog(props HelpDialogProps) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
var_1 := templ.GetChildren(ctx)
if var_1 == nil {
var_1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
err = templ.RenderScriptItems(ctx, templBuffer, props.ShowModal())
if err != nil {
return err
}
_, err = templBuffer.WriteString("<button onClick=\"")
if err != nil {
return err
}
var var_2 templ.ComponentScript = props.ShowModal()
_, err = templBuffer.WriteString(var_2.Call)
if err != nil {
return err
}
_, err = templBuffer.WriteString("\" class=\"hover:bg-base-200 rounded-full p-1\">")
if err != nil {
return err
}
err = icons.QuestionMark(props.Size).Render(ctx, templBuffer)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</button><dialog id=\"")
if err != nil {
return err
}
_, err = templBuffer.WriteString(templ.EscapeString(props.ID))
if err != nil {
return err
}
_, err = templBuffer.WriteString("\" class=\"modal\"><div class=\"modal-box\"><h3 class=\"font-bold text-lg\">")
if err != nil {
return err
}
var_3 := `Help`
_, err = templBuffer.WriteString(var_3)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</h3>")
if err != nil {
return err
}
err = var_1.Render(ctx, templBuffer)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</div><form method=\"dialog\" class=\"modal-backdrop\" hx-disable><button>")
if err != nil {
return err
}
var_4 := `close`
_, err = templBuffer.WriteString(var_4)
if err != nil {
return err
}
_, err = templBuffer.WriteString("</button></form></dialog>")
if err != nil {
return err
}
if !templIsBuffer {
_, err = templBuffer.WriteTo(w)
}
return err
})
}