Every action kind of works.

This commit is contained in:
2025-03-05 21:02:50 -08:00
parent 59d48342ea
commit d19a2988fd
5 changed files with 240 additions and 165 deletions

View File

@@ -1,7 +1,9 @@
(ns auto-ap.ssr.components.dialog
(:require
[auto-ap.ssr.hiccup-helper :as hh]
[auto-ap.ssr.hx :as hx]))
[auto-ap.ssr.components.buttons :as b]
[auto-ap.ssr.hx :as hx]
[auto-ap.ssr.svg :as svg]))
(defn modal-
@@ -31,8 +33,7 @@
content]
(when footer [:div {:class "p-4"}
[:span.items-center.bg-red-100.text-red-800.text-xs.font-medium.mb-2.p-1.rounded-full.inline-flex (hx/alpine-appear {:x-show "unexpectedError" :class "dark:bg-red-900 dark:text-red-300"})
[:span {:class "w-2 h-2 mr-1 bg-red-500 rounded-full"}]
[:span.px-2.py-0.5 "An unexpected error has occured. Integreat staff have been notified."]]
[:span {:class "w-2 h-2 mr-1 bg-red-500 rounded-full"}] [:span.px-2.py-0.5 "An unexpected error has occured. Integreat staff have been notified."]]
(when (:error params )
[:span.items-center.bg-red-100.text-red-800.text-xs.font-medium.mb-2.p-1.rounded-full.inline-flex { :class "dark:bg-red-900 dark:text-red-300"}
[:span {:class "w-2 h-2 mr-1 bg-red-500 rounded-full"}]
@@ -67,3 +68,18 @@
[:div (merge params
{:class (hh/add-class "modal-card bg-white rounded-lg shadow dark:bg-gray-700 dark:text-white modal-content flex flex-col max-h-screen max-w-screen" (:class params "")) })
children])
(defn success-modal- [{:keys [title]} & children]
(modal- {}
(modal-card-advanced-
{:class "transition duration-300 ease-in-out htmx-swapping:-translate-x-2/3 htmx-swapping:opacity-0 htmx-swapping:scale-0 htmx-added:translate-x-2/3 htmx-added:opacity-0 htmx-added:scale-0 scale-100 translate-x-0 opacity-100"}
(modal-body- {}
[:div.flex.flex-col.mt-4.space-y-4.items-center
[:div.w-24.h-24.bg-green-50.rounded-full.p-4.text-green-300.animate-gg
svg/thumbs-up]
[:div.text-center.mt-4
[:h3.text-xl.font-bold title]
children
[:div.mt-6
(b/button- {:color :primary
"@click" "$dispatch('modalclose');"} "Close")]]]))))