style modal component

This commit is contained in:
2021-09-10 21:38:03 -04:00
committed by oliviasculley
parent 8e4e3872f5
commit a11a222bea
2 changed files with 18 additions and 40 deletions

View File

@ -4,16 +4,30 @@ defmodule CanneryWeb.ModalComponent do
@impl true
def render(assigns) do
~L"""
<div id="<%= @id %>" class="phx-modal"
<div id="<%= @id %>" class="fixed z-10 left-0 top-0
w-full h-full overflow-hidden
p-8 flex flex-col justify-center items-center"
style="opacity: 1 !important; background-color: rgba(0,0,0,0.4);"
phx-capture-click="close"
phx-window-keydown="close"
phx-key="escape"
phx-target="#<%= @id %>"
phx-page-loading>
<div class="phx-modal-content">
<%= live_patch raw("&times;"), to: @return_to, class: "phx-modal-close" %>
<%= live_component @socket, @component, @opts %>
<div class="w-full max-w-4xl relative
p-8 flex flex-col justify-start items-center
bg-white border-2 rounded-lg">
<%# close button %>
<%= 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 %>
<i class="fa-fw fa-lg fas fa-times"></i>
<% end %>
<%# modal content %>
<div class="flex flex-col space-y-4 justify-center items-center">
<%= live_component @socket, @component, @opts %>
</div>
</div>
</div>
"""