mirror of
https://github.com/penpot/penpot.git
synced 2025-03-06 21:02:13 -05:00
Add uploading spinner for images page in dashboard.
This commit is contained in:
parent
8e27e19e41
commit
f17642f057
1 changed files with 17 additions and 10 deletions
|
@ -59,6 +59,10 @@
|
||||||
(-> (l/key :images-by-id)
|
(-> (l/key :images-by-id)
|
||||||
(l/derive st/state)))
|
(l/derive st/state)))
|
||||||
|
|
||||||
|
(def ^:private uploading?-ref
|
||||||
|
(-> (l/key :uploading)
|
||||||
|
(l/derive dashboard-ref)))
|
||||||
|
|
||||||
;; --- Page Title
|
;; --- Page Title
|
||||||
|
|
||||||
(mx/defcs page-title
|
(mx/defcs page-title
|
||||||
|
@ -185,22 +189,25 @@
|
||||||
;; --- Grid
|
;; --- Grid
|
||||||
|
|
||||||
(mx/defcs grid-form
|
(mx/defcs grid-form
|
||||||
{:mixins [mx/static]}
|
{:mixins [mx/static mx/reactive]}
|
||||||
[own coll-id]
|
[own coll-id]
|
||||||
(letfn [(forward-click [event]
|
(letfn [(forward-click [event]
|
||||||
(dom/click (mx/ref-node own "file-input")))
|
(dom/click (mx/ref-node own "file-input")))
|
||||||
(on-file-selected [event]
|
(on-file-selected [event]
|
||||||
(let [files (dom/get-event-files event)]
|
(let [files (dom/get-event-files event)]
|
||||||
(rs/emit! (di/create-images coll-id files))))]
|
(rs/emit! (di/create-images coll-id files))))]
|
||||||
[:div.grid-item.add-project {:on-click forward-click}
|
(let [uploading? (mx/react uploading?-ref)]
|
||||||
[:span "+ New image"]
|
[:div.grid-item.add-project {:on-click forward-click}
|
||||||
[:input.upload-image-input
|
(if uploading?
|
||||||
{:style {:display "none"}
|
[:div i/loader-pencil]
|
||||||
:multiple true
|
[:span "+ New image"])
|
||||||
:ref "file-input"
|
[:input.upload-image-input
|
||||||
:value ""
|
{:style {:display "none"}
|
||||||
:type "file"
|
:multiple true
|
||||||
:on-change on-file-selected}]]))
|
:ref "file-input"
|
||||||
|
:value ""
|
||||||
|
:type "file"
|
||||||
|
:on-change on-file-selected}]])))
|
||||||
|
|
||||||
(mx/defc grid-options-copy
|
(mx/defc grid-options-copy
|
||||||
{:mixins [mx/reactive mx/static]}
|
{:mixins [mx/reactive mx/static]}
|
||||||
|
|
Loading…
Add table
Reference in a new issue