mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
64 lines
2.6 KiB
Plaintext
64 lines
2.6 KiB
Plaintext
<%
|
|
modal_id ||= "modal-#{SecureRandom.hex(4)}"
|
|
icon_svg ||= nil
|
|
icon_color ||= "text-primary"
|
|
title ||= "Confirm"
|
|
description ||= nil
|
|
buttons ||= []
|
|
max_width ||= "max-w-md"
|
|
custom ||= nil
|
|
%>
|
|
|
|
<div id="<%= modal_id %>"
|
|
class="fixed inset-0 flex items-center justify-center z-9999 opacity-0 pointer-events-none transition-opacity duration-300 ease-in-out hidden"
|
|
style="background-color: rgba(0, 0, 0, 0.5);backdrop-filter: blur(4px);"
|
|
data-controller="modal">
|
|
<div class="bg-dark border border-primary rounded-lg p-6 <%= max_width %> w-full mx-4 flex flex-col items-center justify-center transform scale-95 transition-transform duration-300 ease-in-out"
|
|
data-modal-target="content">
|
|
<div class="flex flex-col items-center w-full">
|
|
<% if icon_svg %>
|
|
<div class="mb-4 flex justify-center w-full">
|
|
<svg class="w-12 h-12 <%= icon_color %>" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<%= icon_svg.html_safe %>
|
|
</svg>
|
|
</div>
|
|
<% end %>
|
|
|
|
<h3 class="text-2xl font-bold text-white mb-2 text-center w-full"><%= title %></h3>
|
|
|
|
<% if description %>
|
|
<p class="text-gray-300 mb-6 text-center w-full"><%= description %></p>
|
|
<% end %>
|
|
|
|
<% if custom.present? %>
|
|
<%= custom.html_safe %>
|
|
<% end %>
|
|
|
|
<% if buttons.any? %>
|
|
<div class="flex w-full gap-2 items-center justify-center">
|
|
<% buttons.each do |button| %>
|
|
<% if button[:form] %>
|
|
<form method="post" action="<%= button[:url] %>" class="flex-1 basis-1/2 items-center justify-center w-full h-10 m-0">
|
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
|
<% if button[:method] && button[:method] != 'post' %>
|
|
<input type="hidden" name="_method" value="<%= button[:method] %>">
|
|
<% end %>
|
|
<button type="submit"
|
|
class="w-full h-10 px-4 rounded-lg transition-colors duration-200 font-medium cursor-pointer m-0 <%= button[:class] %>">
|
|
<%= button[:text] %>
|
|
</button>
|
|
</form>
|
|
<% else %>
|
|
<button type="button"
|
|
data-action="<%= button[:action] || 'click->modal#close' %>"
|
|
class="flex-1 basis-1/2 items-center justify-center w-full h-10 px-4 rounded-lg transition-colors duration-200 cursor-pointer m-0 <%= button[:class] %>">
|
|
<%= button[:text] %>
|
|
</button>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|