mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
💄 Add cosmetic changes to dashboard templates layer
This commit is contained in:
parent
d46274abf2
commit
b0bfb8006d
2 changed files with 21 additions and 10 deletions
|
@ -195,19 +195,17 @@
|
|||
(fn [_event]
|
||||
(swap! collapsed* not)))
|
||||
|
||||
update-can-move
|
||||
(fn [scroll-left scroll-available client-width]
|
||||
(reset! can-move {:left (> scroll-left 0)
|
||||
:right (> scroll-available client-width)}))
|
||||
|
||||
on-scroll
|
||||
(mf/use-fn
|
||||
(fn [e]
|
||||
(let [scroll (dom/get-target-scroll e)
|
||||
scroll-left (:scroll-left scroll)
|
||||
scroll-available (- (:scroll-width scroll) scroll-left)
|
||||
client-rect (dom/get-client-size (dom/get-target e))]
|
||||
(update-can-move scroll-left scroll-available (unchecked-get client-rect "width")))))
|
||||
client-rect (dom/get-client-size (dom/get-target e))
|
||||
client-width (unchecked-get client-rect "width")]
|
||||
|
||||
(reset! can-move {:left (> scroll-left 0)
|
||||
:right (> scroll-available client-width)}))))
|
||||
|
||||
on-move-left
|
||||
(mf/use-fn #(move-left))
|
||||
|
@ -231,7 +229,7 @@
|
|||
(let [content (mf/ref-val content-ref)]
|
||||
(when (and (some? content) (some? templates))
|
||||
(dom/scroll-to content #js {:behavior "instant" :left 0 :top 0})
|
||||
(.dispatchEvent content (js/Event. "scroll")))))
|
||||
(dom/dispatch-event content (dom/event "scroll")))))
|
||||
|
||||
(mf/with-effect [profile collapsed]
|
||||
(swap! storage/global assoc ::collapsed collapsed)
|
||||
|
|
|
@ -720,6 +720,19 @@
|
|||
[filename blob]
|
||||
(trigger-download-uri filename (.-type ^js blob) (wapi/create-uri blob)))
|
||||
|
||||
(defn event
|
||||
"Create an instance of DOM Event"
|
||||
([^string type]
|
||||
(js/Event. type))
|
||||
([^string type options]
|
||||
(js/Event. type options)))
|
||||
|
||||
(defn dispatch-event
|
||||
[target event]
|
||||
(when (some? target)
|
||||
(.dispatchEvent ^js target event)))
|
||||
|
||||
|
||||
(defn save-as
|
||||
[uri filename mtype description]
|
||||
|
||||
|
|
Loading…
Reference in a new issue