defmodule CanneryWeb.ModalComponent do
@moduledoc """
Livecomponent that displays a floating modal window
"""
use CanneryWeb, :live_component
@impl true
def render(assigns) do
~H"""
<%= live_patch to: @return_to,
class: "absolute top-8 right-10 text-gray-500 hover:text-gray-800
transition-all duration-500 ease-in-out" do %>
<% end %>
<%= live_component(@component, @opts) %>
"""
end
@impl true
def handle_event("close", _, socket) do
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
end
end