enhance: set initial breakpoint to 0.75

Otherwise, options could be blocked by keyboard
This commit is contained in:
Tienson Qin
2025-06-23 17:12:13 +08:00
parent 3eecbfef47
commit ca963fa492

View File

@@ -13,13 +13,13 @@
vh js/window.innerHeight
[th bh] [y (- vh (+ y height) 300)]]
(case (if (> bh 280) "bottom"
(if (> (- th bh) 100)
"top" "bottom"))
(if (> (- th bh) 100)
"top" "bottom"))
"top" ["top" th]
["bottom" bh]))]
(-> (assoc opts :auto-side? false)
(assoc :max-popup-height mh)
(assoc-in [:content-props :side] side))))
(assoc :max-popup-height mh)
(assoc-in [:content-props :side] side))))
(defn popup-show!
[event content-fn {:keys [id dropdown-menu?] :as opts}]
@@ -29,7 +29,7 @@
side (some-> opts :content-props :side)
max-h (some-> opts :max-popup-height (js/parseInt) (- 48))
_ (when max-h (js/document.documentElement.style.setProperty
(str "--" side "-popup-content-max-height") (str max-h "px")))
(str "--" side "-popup-content-max-height") (str max-h "px")))
pid (shui-popup/show! event content-fn opts)]
(reset! *last-popup-modal? false) pid)
@@ -56,17 +56,17 @@
[]
(let [{:keys [open? content-fn opts]} (rum/react state/*popup-data)]
(ion/modal
(merge
{:isOpen (boolean open?)
:initialBreakpoint 0.5
:breakpoints #js [0 0.5 0.75 1]
:onDidDismiss (fn [] (state/set-popup! nil))
:expand "block"}
(:modal-props opts))
(ion/content
{:class "ion-padding"}
[:<>
(when-let [title (:title opts)]
[:h2.py-2.opacity-40 title])
(when content-fn
(content-fn))]))))
(merge
{:isOpen (boolean open?)
:initialBreakpoint 0.75
:breakpoints #js [0 0.5 0.75 1]
:onDidDismiss (fn [] (state/set-popup! nil))
:expand "block"}
(:modal-props opts))
(ion/content
{:class "ion-padding"}
[:<>
(when-let [title (:title opts)]
[:h2.py-2.opacity-40 title])
(when content-fn
(content-fn))]))))