Skip to content

Commit

Permalink
UI menu improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleu committed Oct 12, 2024
1 parent a7b1572 commit 5eb6464
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 148 deletions.
14 changes: 9 additions & 5 deletions views/layout/Nav.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% import (
"fmt"
"net/http"

"github.com/kyleu/rituals/app"
"github.com/kyleu/rituals/app/controller/cutil"
Expand Down Expand Up @@ -31,14 +32,17 @@
</nav>{% endfunc %}

{% func NavItem(link string, title string, icon string, description string, last bool, ps *cutil.PageState) %}{% stripspace %}
{% if link != "" || last %}
{%- code extra := util.Choose(description == "", "", fmt.Sprintf(" title=%q", description)) -%}
<a class="link{% if last %}{% space %}last{% endif %}" href="{%s link %}"{%s= extra %}>
{% code shouldLink := link != "" || (last && ps.Method == http.MethodGet) %}
{% if shouldLink %}
{%- code extra := util.Choose(description == "", "", fmt.Sprintf(" title=%q", description)) -%}
<a class="link{% if last %}{% space %}last{% endif %}" href="{%s link %}"{%s= extra %}>
{% endif %}

<span>{%= components.SVGBreadcrumb(icon, ps) %}</span>
<span class="nav-item-title">{%s title %}</span>
{% if link != "" || last %}
</a>

{% if shouldLink %}
</a>
{% endif %}
{% endstripspace %}{% endfunc %}

Expand Down
Loading

0 comments on commit 5eb6464

Please sign in to comment.