mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-02-21 21:36:17 +08:00
* Update phoenix deps
* Update reference to LiveDashboard encode_pid
* Fix form input id references
* Move to HEEx
* Update back to filesystem LV npm package
* Further HEEx rewrites
* Refactor icons into function components
* .html.leex -> .html.heex
* Further refactoring
* Move render helpers into function components
* Add doctype back
* Further refactoring
* Refactor cell component
* Further refactoring
* Compose sidebar using function components
* Rewrite notebook card component as function component
* Fruther refactoring
* Fix race condition in runtime tests
* Rewrite tooltips into function component
* Update Tailwind purge rules
* Revert "Rewrite tooltips into function component"
This reverts commit bd6ca8f0b5
.
* Refactor conditional tooltip
41 lines
1.2 KiB
Elixir
41 lines
1.2 KiB
Elixir
defmodule LivebookWeb.ModalComponent do
|
|
use LivebookWeb, :live_component
|
|
|
|
@impl true
|
|
def render(assigns) do
|
|
~H"""
|
|
<div class="fixed z-[10000] inset-0">
|
|
|
|
<!-- Modal container -->
|
|
<div class="h-screen flex items-center justify-center p-4">
|
|
<!-- Overlay -->
|
|
<div class="absolute inset-0 bg-gray-500 opacity-75 z-0"
|
|
aria-hidden="true"
|
|
phx-capture-click="close"
|
|
phx-window-keydown="close"
|
|
phx-key="escape"
|
|
phx-target={@myself}
|
|
phx-page-loading></div>
|
|
|
|
<!-- Modal box -->
|
|
<div class={"relative max-h-full overflow-y-auto bg-white rounded-lg shadow-xl #{@modal_class}"}
|
|
role="dialog"
|
|
aria-modal="true">
|
|
|
|
<%= live_patch to: @return_to, class: "absolute top-6 right-6 text-gray-400 flex space-x-1 items-center" do %>
|
|
<span class="text-sm">(esc)</span>
|
|
<.remix_icon icon="close-line" class="text-2xl" />
|
|
<% end %>
|
|
|
|
<%= live_component @component, @opts %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
"""
|
|
end
|
|
|
|
@impl true
|
|
def handle_event("close", _params, socket) do
|
|
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
|
|
end
|
|
end
|