defmodule Bones73kWeb.ModalComponent do
use Bones73kWeb, :live_component
@impl true
def render(assigns) do
~L"""
<%= Keyword.get(@opts, :title, "Modal title") %>
<%= live_component @socket, @component, @opts %>
"""
end
@impl true
def handle_event("close", _, socket) do
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
end
@impl true
def handle_event("hide", _, socket) do
{:noreply, push_event(socket, "modal-please-hide", %{})}
end
end