Hi, I have an issue with dynamic css classes after upgrading from live_view 0.16 to 0.17. I have a function component for a navigation bar entry like this:
def nav_item_path(assigns) do
~H"""
<li class={"nav-item #{if @conn.request_path == @route, do: "active"}"}>
<%= link to: @route, class: "nav-link" do %>
<%= if assigns[:icon] do %><i class="material-icons"><%= @icon %></i><% end %>
<%= if assigns[:title] do %><p><%= @title %></p><% end %>
<% end %>
</li>
"""
end
As you can see, the active css class is set dynamically. It worked fine with 0.16 but after upgrading the generated HTML looks like:
<li class="nav-item <i class=" material-icons"="">device_hub">
<a class="nav-link" href="/admin/***/****">
<i class="material-icons">device_hub</i>
******
</a>
</li>
Am I using it wrong? Is there a better way to achieve this?
Additional information: I use this component in a dead view.