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]
|
(fn [_event]
|
||||||
(swap! collapsed* not)))
|
(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
|
on-scroll
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(let [scroll (dom/get-target-scroll e)
|
(let [scroll (dom/get-target-scroll e)
|
||||||
scroll-left (:scroll-left scroll)
|
scroll-left (:scroll-left scroll)
|
||||||
scroll-available (- (:scroll-width scroll) scroll-left)
|
scroll-available (- (:scroll-width scroll) scroll-left)
|
||||||
client-rect (dom/get-client-size (dom/get-target e))]
|
client-rect (dom/get-client-size (dom/get-target e))
|
||||||
(update-can-move scroll-left scroll-available (unchecked-get client-rect "width")))))
|
client-width (unchecked-get client-rect "width")]
|
||||||
|
|
||||||
|
(reset! can-move {:left (> scroll-left 0)
|
||||||
|
:right (> scroll-available client-width)}))))
|
||||||
|
|
||||||
on-move-left
|
on-move-left
|
||||||
(mf/use-fn #(move-left))
|
(mf/use-fn #(move-left))
|
||||||
|
@ -231,7 +229,7 @@
|
||||||
(let [content (mf/ref-val content-ref)]
|
(let [content (mf/ref-val content-ref)]
|
||||||
(when (and (some? content) (some? templates))
|
(when (and (some? content) (some? templates))
|
||||||
(dom/scroll-to content #js {:behavior "instant" :left 0 :top 0})
|
(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]
|
(mf/with-effect [profile collapsed]
|
||||||
(swap! storage/global assoc ::collapsed collapsed)
|
(swap! storage/global assoc ::collapsed collapsed)
|
||||||
|
|
|
@ -720,6 +720,19 @@
|
||||||
[filename blob]
|
[filename blob]
|
||||||
(trigger-download-uri filename (.-type ^js blob) (wapi/create-uri 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
|
(defn save-as
|
||||||
[uri filename mtype description]
|
[uri filename mtype description]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue