1
|
|
|
// Code generated by templ - DO NOT EDIT. |
2
|
|
|
|
3
|
|
|
// templ: version: v0.2.543 |
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 Navbar(username string, fromProtected bool) 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("<nav class=\"navbar transition-all md:px-5\" data-testid=\"navbar\"><div class=\"navbar-start\" data-testid=\"navbarStart\"></div><div class=\"navbar-center\" data-testid=\"navbarCenter\"><a hx-swap=\"transition:true\" href=\"/\" class=\"text-3xl font-bold\">Memnix</a></div><div class=\"navbar-end\" data-testid=\"navbarEnd\">") |
27
|
|
|
if templ_7745c5c3_Err != nil { |
28
|
|
|
return templ_7745c5c3_Err |
29
|
|
|
} |
30
|
|
|
if fromProtected { |
31
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span class=\"font-bold text-indigo-700 mr-8\" data-testid=\"username\">") |
32
|
|
|
if templ_7745c5c3_Err != nil { |
33
|
|
|
return templ_7745c5c3_Err |
34
|
|
|
} |
35
|
|
|
var templ_7745c5c3_Var2 string |
36
|
|
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(username) |
37
|
|
|
if templ_7745c5c3_Err != nil { |
38
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `app/v2/views/partials/navbar.partial.templ`, Line: 13, Col: 15} |
39
|
|
|
} |
40
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) |
41
|
|
|
if templ_7745c5c3_Err != nil { |
42
|
|
|
return templ_7745c5c3_Err |
43
|
|
|
} |
44
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span> <button hx-swap=\"transition:true\" hx-post=\"/todo/logout\" hx-confirm=\"Are you sure you want to log out?\" hx-target=\"body\" hx-push-url=\"true\" class=\"btn btn-ghost text-lg\" data-testid=\"logoutButton\">Logout</button>") |
45
|
|
|
if templ_7745c5c3_Err != nil { |
46
|
|
|
return templ_7745c5c3_Err |
47
|
|
|
} |
48
|
|
|
} else { |
49
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-swap=\"transition:true\" data-testid=\"loginButton\" class=\"btn btn-primary text-lg\" href=\"/login\">Login</a>") |
50
|
|
|
if templ_7745c5c3_Err != nil { |
51
|
|
|
return templ_7745c5c3_Err |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></nav>") |
55
|
|
|
if templ_7745c5c3_Err != nil { |
56
|
|
|
return templ_7745c5c3_Err |
57
|
|
|
} |
58
|
|
|
if !templ_7745c5c3_IsBuffer { |
59
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) |
60
|
|
|
} |
61
|
|
|
return templ_7745c5c3_Err |
62
|
|
|
}) |
63
|
|
|
} |
64
|
|
|
|