Sfoglia il codice sorgente

enhance(modal): add default-height option to action sheets

charlie 2 mesi fa
parent
commit
a221383ca1

+ 1 - 0
src/main/mobile/components/header.cljs

@@ -133,5 +133,6 @@
                                         (shui/tabler-icon "bug" {:class "opacity-70" :size 22})
                                         "Report bug"])])
                       {:title "Actions"
+                       :default-height false
                        :type :action-sheet}))}
         (shui/tabler-icon "dots" {:size 23}))]))))

+ 1 - 0
src/main/mobile/components/modal.cljs

@@ -112,6 +112,7 @@
                                   (shui/tabler-icon "trash" {:class "opacity-80" :size 22})
                                   "Delete"])])
                              {:title "Actions"
+                              :default-height false
                               :type :action-sheet}))}
                (shui/tabler-icon "dots-vertical" {:size 20}))]]
 

+ 5 - 2
src/main/mobile/components/popup.cljs

@@ -70,7 +70,8 @@
   []
   (let [{:keys [open? content-fn opts]} (rum/react mobile-state/*popup-data)
         quick-add? (= :ls-quick-add (:id opts))
-        action-sheet? (= :action-sheet (:type opts))]
+        action-sheet? (= :action-sheet (:type opts))
+        default-height (:default-height opts)]
 
     (when open?
       (state/clear-edit!)
@@ -103,7 +104,9 @@
         (silkhq/bottom-sheet-handle)
         (let [title (or (:title opts) (when (string? content-fn) content-fn))
               content (if (fn? content-fn)
-                        [:div {:style {:min-height 300}}
+                        [:div {:style (cond-> {}
+                                        (or (nil? default-height) (number? default-height))
+                                        (assoc :min-height (or default-height 300)))}
                          (content-fn)]
                         (if-let [buttons (and action-sheet? (:buttons opts))]
                           [:div.-mx-2