diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-12-19 22:24:39 +0100 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2024-12-19 22:24:39 +0100 |
commit | a047ca73226d7638151d62c1612fa5be8628be0f (patch) | |
tree | 558fa00a66bdd6a45b5f088c9ed6bd162af08770 | |
parent | 1b3f353ede24ec6544df63b9298e4157942e1eed (diff) |
feat: simplify modals styles
-rw-r--r-- | src/frontend/tubo/modals/views.cljs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/frontend/tubo/modals/views.cljs b/src/frontend/tubo/modals/views.cljs index af05fce..a17e481 100644 --- a/src/frontend/tubo/modals/views.cljs +++ b/src/frontend/tubo/modals/views.cljs @@ -5,29 +5,28 @@ (defn modal-content [title body & extra-buttons] - [:div.bg-white.dark:bg-neutral-900.max-h-full.flex.flex-col.flex-auto.shrink-0.gap-y-5.border.border-neutral-300.dark:border-neutral-700.rounded.p-5.z-20 - [:div.flex.justify-between.shrink-0 + [:div.bg-neutral-100.dark:bg-neutral-900.flex.flex-col.flex-auto.gap-y-5.rounded.p-5 + [:div.flex.justify-between [:h1.text-xl.font-semibold title] [:button {:on-click #(rf/dispatch [:modals/close])} [:i.fa-solid.fa-close]]] [:div.flex-auto.overflow-y-auto body] - [:div.flex.justify-end.gap-x-3.shrink-0 + [:div.flex.justify-end.gap-x-3 (if extra-buttons (map-indexed #(with-meta %2 {:key %1}) extra-buttons) [layout/primary-button "Ok" #(rf/dispatch [:modals/close])])]]) (defn modal-panel [{:keys [child]}] - [:div.fixed.z-30.flex.flex-col.items-center.justify-center + [:div.flex.fixed.z-30 {:class ["top-1/2" "left-1/2" "-translate-x-1/2" "-translate-y-1/2" - "w-4/5" "sm:w-3/4" "md:w-3/5" "lg:w-1/2" "xl:w-1/3"]} - [:div.w-full.max-h-full - child]]) + "w-11/12" "sm:w-3/4" "md:w-3/5" "lg:w-1/2" "xl:w-1/3" + "max-h-[90dvh]"]} + child]) (defn modals-container [] - (fn [] - (let [modals @(rf/subscribe [:modals]) - visible-modal (last (filter :show? modals))] - (when visible-modal - [modal-panel visible-modal])))) + (let [modals @(rf/subscribe [:modals]) + visible-modal (last (filter :show? modals))] + (when visible-modal + [modal-panel visible-modal]))) |