mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
Fix react index warning
This commit is contained in:
parent
aa75f30858
commit
1776591fec
1 changed files with 24 additions and 23 deletions
|
@ -504,29 +504,30 @@
|
|||
[context-data]
|
||||
(let [menu-entries (generate-menu-entries context-data)]
|
||||
(for [[index {:keys [title action selected? submenu] :as entry}] (d/enumerate menu-entries)]
|
||||
(cond
|
||||
(= :separator entry) [:& menu-separator]
|
||||
:else
|
||||
[:& menu-entry (cond-> {:key index
|
||||
:title title}
|
||||
(not submenu) (assoc :on-click action
|
||||
;; TODO: Allow selected items wihtout an icon for the context menu
|
||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||
:hidden-icon (not selected?))}])
|
||||
:selected? selected?))
|
||||
(when submenu
|
||||
(let [submenu-entries (-> (assoc context-data :type submenu)
|
||||
(generate-menu-entries))]
|
||||
(for [[index {:keys [title action selected?] :as sub-entry}] (d/enumerate submenu-entries)]
|
||||
(cond
|
||||
(= :separator sub-entry) [:& menu-separator]
|
||||
:else
|
||||
[:& menu-entry {:key index
|
||||
:title title
|
||||
:on-click action
|
||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||
:hidden-icon (not selected?))}])
|
||||
:selected? selected?}]))))]))))
|
||||
[:* {:key (str title " " index)}
|
||||
(cond
|
||||
(= :separator entry) [:& menu-separator]
|
||||
:else
|
||||
[:& menu-entry (cond-> {:title title}
|
||||
(not submenu) (assoc :on-click action
|
||||
;; TODO: Allow selected items wihtout an icon for the context menu
|
||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||
:hidden-icon (not selected?))}])
|
||||
:selected? selected?))
|
||||
(when submenu
|
||||
(let [submenu-entries (-> (assoc context-data :type submenu)
|
||||
(generate-menu-entries))]
|
||||
(for [[index {:keys [title action selected?] :as sub-entry}] (d/enumerate submenu-entries)]
|
||||
[:* {:key (str title " " index)}
|
||||
(cond
|
||||
(= :separator sub-entry) [:& menu-separator]
|
||||
:else
|
||||
[:& menu-entry {:key index
|
||||
:title title
|
||||
:on-click action
|
||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||
:hidden-icon (not selected?))}])
|
||||
:selected? selected?}])])))])])))
|
||||
|
||||
(mf/defc token-context-menu
|
||||
[]
|
||||
|
|
Loading…
Add table
Reference in a new issue