pass through assign attrs in link#navigate helper

This commit is contained in:
Jon Principe 2022-03-09 21:38:06 -05:00
parent b5edfdd9cd
commit 306a16ba9c

View file

@ -124,9 +124,11 @@ defmodule LiveBeatsWeb.LiveHelpers do
def link(%{navigate: _to} = assigns) do
assigns = assign_new(assigns, :class, fn -> nil end)
opts = assigns_to_attributes(assigns, [:navigate])
assigns = assign(assigns, :opts, opts)
~H"""
<a href={@navigate} data-phx-link="redirect" data-phx-link-state="push" class={@class}>
<a href={@navigate} data-phx-link="redirect" data-phx-link-state="push" {@opts}>
<%= render_slot(@inner_block) %>
</a>
"""