use htmx for navigation
This commit is contained in:
@@ -10,11 +10,15 @@ templ Sidebar(routes []NavRoutes) {
|
||||
for _, r := range routes {
|
||||
<li>
|
||||
<a
|
||||
href={ r.Path }
|
||||
hx-get={ r.Path }
|
||||
hx-target="main"
|
||||
hx-swap="innerHTML"
|
||||
class="sidebar-link rounded-lg py-2.5 px-3 text-base-content items-center"
|
||||
>
|
||||
if r.Icon != nil {
|
||||
<span class="sidebar-icon flex items-center justify-center">@r.Icon</span>
|
||||
<span class="sidebar-icon flex items-center justify-center">
|
||||
@r.Icon
|
||||
</span>
|
||||
}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -34,20 +34,20 @@ func Sidebar(routes []NavRoutes) templ.Component {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, r := range routes {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a href=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<li><a hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 templ.SafeURL
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinURLErrs(r.Path)
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(r.Path)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/sidebar.templ`, Line: 13, Col: 20}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/web/components/sidebar.templ`, Line: 13, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"sidebar-link rounded-lg py-2.5 px-3 text-base-content items-center\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" hx-target=\"main\" hx-swap=\"innerHTML\" class=\"sidebar-link rounded-lg py-2.5 px-3 text-base-content items-center\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user