mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 13:41:43 +02:00
✨ Improve loading state on dashboard.
This commit is contained in:
parent
b2bd4bd694
commit
404fae9c7c
5 changed files with 51 additions and 38 deletions
|
@ -183,16 +183,25 @@
|
|||
|
||||
(mf/defc empty-placeholder
|
||||
[]
|
||||
(let [locale (mf/deref i18n/locale)]
|
||||
[:div.grid-empty-placeholder
|
||||
[:div.icon i/file-html]
|
||||
[:div.text (t locale "dashboard.empty-files")]]))
|
||||
[:div.grid-empty-placeholder
|
||||
[:div.icon i/file-html]
|
||||
[:div.text (tr "dashboard.empty-files")]])
|
||||
|
||||
(mf/defc loading-placeholder
|
||||
[]
|
||||
[:div.grid-empty-placeholder
|
||||
[:div.icon i/loader]
|
||||
[:div.text (tr "dashboard.loading-files")]])
|
||||
|
||||
(mf/defc grid
|
||||
[{:keys [id opts files] :as props}]
|
||||
(let [locale (mf/deref i18n/locale)]
|
||||
[:section.dashboard-grid
|
||||
(if (pos? (count files))
|
||||
(cond
|
||||
(nil? files)
|
||||
[:& loading-placeholder]
|
||||
|
||||
(seq files)
|
||||
[:div.grid-row
|
||||
(for [item files]
|
||||
[:& grid-item
|
||||
|
@ -200,6 +209,7 @@
|
|||
:file item
|
||||
:key (:id item)}])]
|
||||
|
||||
:else
|
||||
[:& empty-placeholder])]))
|
||||
|
||||
(mf/defc line-grid-row
|
||||
|
@ -255,9 +265,15 @@
|
|||
[{:keys [project-id opts files on-load-more] :as props}]
|
||||
(let [locale (mf/deref i18n/locale)]
|
||||
[:section.dashboard-grid
|
||||
(if (pos? (count files))
|
||||
(cond
|
||||
(nil? files)
|
||||
[:& loading-placeholder]
|
||||
|
||||
(seq files)
|
||||
[:& line-grid-row {:files files
|
||||
:on-load-more on-load-more
|
||||
:locale locale}]
|
||||
|
||||
:else
|
||||
[:& empty-placeholder])]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue