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

This commit is contained in:
charlie
2025-08-15 11:07:43 +08:00
parent c32dadb047
commit a221383ca1
3 changed files with 7 additions and 2 deletions

View File

@@ -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}))]))))

View File

@@ -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}))]]

View File

@@ -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