use htmx for navigation
This commit is contained in:
@@ -10,11 +10,15 @@ templ Sidebar(routes []NavRoutes) {
|
|||||||
for _, r := range routes {
|
for _, r := range routes {
|
||||||
<li>
|
<li>
|
||||||
<a
|
<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"
|
class="sidebar-link rounded-lg py-2.5 px-3 text-base-content items-center"
|
||||||
>
|
>
|
||||||
if r.Icon != nil {
|
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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -34,20 +34,20 @@ func Sidebar(routes []NavRoutes) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
for _, r := range routes {
|
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 {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var2 templ.SafeURL
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinURLErrs(r.Path)
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(r.Path)
|
||||||
if templ_7745c5c3_Err != nil {
|
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))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
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 {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user