mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 21:11:38 +02:00
✨ Improve file thumbnails.
This commit is contained in:
parent
ab4171b8ec
commit
97d49e53b7
4 changed files with 38 additions and 37 deletions
|
@ -69,25 +69,25 @@
|
|||
|
||||
;; (mf/defc grid-item-thumbnail
|
||||
;; [{:keys [file] :as props}]
|
||||
;; [:div.grid-item-th
|
||||
;; [:img.img-th {:src "/images/project-placeholder.svg"}]])
|
||||
;; (let [url (mf/use-memo
|
||||
;; {:fn #(let [content (exports/render file)
|
||||
;; blob (js/Blob. #js [content] #js {:type "image/svg+xml"})]
|
||||
;; (js/URL.createObjectURL blob))
|
||||
;; :deps (mf/deps (:id file))})]
|
||||
;; (mf/use-effect
|
||||
;; {:fn (fn []
|
||||
;; #(js/URL.revokeObjectURL url))
|
||||
;; :deps (mf/deps (:id file))})
|
||||
;; [:div.grid-item-th
|
||||
;; [:img.img-th {:src url}]]))
|
||||
|
||||
;; (defn use-thumbnail
|
||||
;; [file]
|
||||
|
||||
(mf/defc grid-item-thumbnail
|
||||
[{:keys [file] :as props}]
|
||||
(let [url (mf/use-memo
|
||||
{:fn #(let [content (exports/render file)
|
||||
blob (js/Blob. #js [content] #js {:type "image/svg+xml"})]
|
||||
(js/URL.createObjectURL blob))
|
||||
:deps (mf/deps (:id file))})]
|
||||
(mf/use-effect
|
||||
{:fn (fn []
|
||||
#(js/URL.revokeObjectURL url))
|
||||
:deps (mf/deps (:id file))})
|
||||
[:div.grid-item-th
|
||||
[:img.img-th {:src url}]]))
|
||||
[:div.grid-item-th
|
||||
[:& exports/page-svg2 {:data (:data file)
|
||||
:width "290"
|
||||
:height "150"}]])
|
||||
|
||||
;; --- Grid Item
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue