How to set conditional class names in a template. Looking at the code below I’m wanting to toggle between bg-gray-900 and bg-gray-300 depending if the page is the active page. ie. `@page = “settings”?
<%= link "Account Settings", to: Routes.user_settings_path(@conn, :edit), class: "px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-md" %>
I ended up using this inline conditional for applying the class, works for my use case and I feel it keeps it simple. Just set a ‘page’ variable on the render/3 in the controller.