0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

remove unused prop and some optimizations

This commit is contained in:
Akshay Gupta 2024-08-20 20:55:02 +05:30
parent 463ab3c866
commit 5b1eaf4b8f
No known key found for this signature in database
2 changed files with 6 additions and 11 deletions

View file

@ -53,7 +53,7 @@
(assoc state :selected-set-id set-id))))
(mf/defc sets-tree
[{:keys [selected-set-id set-id toggle-visibility]}]
[{:keys [selected-set-id set-id]}]
(let [set (get sets set-id)]
(when set
(let [{:keys [type name children]} set
@ -90,16 +90,12 @@
(when (and children (not @collapsed?))
[:div {:class (stl/css :set-children)}
(for [child-id children]
(do
^{:key (str child-id)} [:& sets-tree {:key (str child-id) :set-id child-id :selected-set-id selected-set-id :toggle-visibility toggle-visibility}]))])]))))
[:& sets-tree {:key child-id :set-id child-id :selected-set-id selected-set-id}])])]))))
(mf/defc sets-list
[{:keys [selected-set-id]}]
(let [toggle-visibility (fn [set-id]
(if (contains? active-sets set-id)
(swap! active-sets disj set-id)
(swap! active-sets conj set-id)))]
[:ul {:class (stl/css :sets-list)}
(for [set-id sets-root-order]
^{:key (str set-id)}
[:& sets-tree {:key (str set-id) :set-id set-id :selected-set-id selected-set-id}])]))
[:& sets-tree {:key set-id
:set-id set-id
:selected-set-id selected-set-id}])])

View file

@ -175,8 +175,7 @@
[]
(let [selected-set-id (mf/deref selected-set-id)
open? (mf/use-state true)]
[:div {:key (str "sidebar-" selected-set-id)
:class (stl/css :sets-sidebar)}
[:div {:class (stl/css :sets-sidebar)}
[:div {:class (stl/css :sidebar-header)}
[:& title-bar {:collapsable true
:collapsed (not @open?)