mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-11-22 16:10:59 +00:00
28 lines
652 B
Elixir
28 lines
652 B
Elixir
defmodule LiveBeatsWeb.ModalComponent do
|
|
use LiveBeatsWeb, :live_component
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div
|
|
id={@id}
|
|
class="phx-modal"
|
|
phx-capture-click="close"
|
|
phx-window-keydown="close"
|
|
phx-key="escape"
|
|
phx-target={@myself}
|
|
phx-page-loading>
|
|
|
|
<div class="phx-modal-content">
|
|
<%= live_patch raw("×"), to: @return_to, class: "phx-modal-close" %>
|
|
<%= live_component @component, @opts %>
|
|
</div>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def handle_event("close", _, socket) do
|
|
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
|
|
end
|
|
end
|