0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 15:51:37 -05:00

Improve behavior of nav tabs on images page.

This commit is contained in:
Andrey Antukh 2016-10-26 23:38:19 +02:00
parent f9366c3146
commit 4c0f344c72
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -138,7 +138,7 @@
(tr "ds.num-elements" (t/c num-images))]]))) (tr "ds.num-elements" (t/c num-images))]])))
(mx/defc nav-section (mx/defc nav-section
{:mixins [mx/static mx/reactive]} {:mixins [mx/static]}
[type selected colls] [type selected colls]
(let [own? (= type :own) (let [own? (= type :own)
builtin? (= type :builtin) builtin? (= type :builtin)
@ -166,14 +166,15 @@
(let [own? (= type :own) (let [own? (= type :own)
builtin? (= type :builtin)] builtin? (= type :builtin)]
(letfn [(select-tab [type] (letfn [(select-tab [type]
(let [xf (comp (if own?
(map second) (rs/emit! (di/select-collection type))
(filter #(= type (:type %)))) (let [coll (->> (map second colls)
colls (->> (into [] xf colls) (filter #(= type (:type %)))
(sort-by :name))] (sort-by :name)
(if-let [item (first colls)] (first))]
(rs/emit! (di/select-collection type (:id item))) (if coll
(rs/emit! (di/select-collection type)))))] (rs/emit! (di/select-collection type (:id coll)))
(rs/emit! (di/select-collection type))))))]
[:div.library-bar [:div.library-bar
[:div.library-bar-inside [:div.library-bar-inside
[:ul.library-tabs [:ul.library-tabs