mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -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]
|
[context-data]
|
||||||
(let [menu-entries (generate-menu-entries context-data)]
|
(let [menu-entries (generate-menu-entries context-data)]
|
||||||
(for [[index {:keys [title action selected? submenu] :as entry}] (d/enumerate menu-entries)]
|
(for [[index {:keys [title action selected? submenu] :as entry}] (d/enumerate menu-entries)]
|
||||||
(cond
|
[:* {:key (str title " " index)}
|
||||||
(= :separator entry) [:& menu-separator]
|
(cond
|
||||||
:else
|
(= :separator entry) [:& menu-separator]
|
||||||
[:& menu-entry (cond-> {:key index
|
:else
|
||||||
:title title}
|
[:& menu-entry (cond-> {:title title}
|
||||||
(not submenu) (assoc :on-click action
|
(not submenu) (assoc :on-click action
|
||||||
;; TODO: Allow selected items wihtout an icon for the context menu
|
;; TODO: Allow selected items wihtout an icon for the context menu
|
||||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||||
:hidden-icon (not selected?))}])
|
:hidden-icon (not selected?))}])
|
||||||
:selected? selected?))
|
:selected? selected?))
|
||||||
(when submenu
|
(when submenu
|
||||||
(let [submenu-entries (-> (assoc context-data :type submenu)
|
(let [submenu-entries (-> (assoc context-data :type submenu)
|
||||||
(generate-menu-entries))]
|
(generate-menu-entries))]
|
||||||
(for [[index {:keys [title action selected?] :as sub-entry}] (d/enumerate submenu-entries)]
|
(for [[index {:keys [title action selected?] :as sub-entry}] (d/enumerate submenu-entries)]
|
||||||
(cond
|
[:* {:key (str title " " index)}
|
||||||
(= :separator sub-entry) [:& menu-separator]
|
(cond
|
||||||
:else
|
(= :separator sub-entry) [:& menu-separator]
|
||||||
[:& menu-entry {:key index
|
:else
|
||||||
:title title
|
[:& menu-entry {:key index
|
||||||
:on-click action
|
:title title
|
||||||
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
:on-click action
|
||||||
:hidden-icon (not selected?))}])
|
:icon (mf/html [:div {:class (stl/css-case :empty-icon true
|
||||||
:selected? selected?}]))))]))))
|
:hidden-icon (not selected?))}])
|
||||||
|
:selected? selected?}])])))])])))
|
||||||
|
|
||||||
(mf/defc token-context-menu
|
(mf/defc token-context-menu
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Add table
Reference in a new issue