mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Use non editable context in form
This commit is contained in:
parent
4dd3367bdd
commit
3b7432a859
3 changed files with 14 additions and 4 deletions
|
@ -18,7 +18,8 @@
|
|||
[app.main.ui.workspace.tokens.token-set :as wtts]
|
||||
[app.util.dom :as dom]
|
||||
[rumext.v2 :as mf]
|
||||
[cuerdas.core :as str]))
|
||||
[cuerdas.core :as str]
|
||||
[app.main.ui.workspace.tokens.sets-context :as sets-context]))
|
||||
|
||||
(def ^:private chevron-icon
|
||||
(i/icon-xref :arrow (stl/css :chevron-icon)))
|
||||
|
@ -159,7 +160,8 @@
|
|||
:token-set-selected? (constantly false)
|
||||
:token-set-active? token-set-active?
|
||||
:on-select on-toggle-token-set
|
||||
:on-toggle on-toggle-token-set}]]
|
||||
:on-toggle on-toggle-token-set
|
||||
:context sets-context/static-context}]]
|
||||
[:div {:class (stl/css :edit-theme-footer)}
|
||||
(if edit?
|
||||
[:button {:class (stl/css :button-secondary)
|
||||
|
|
|
@ -128,9 +128,10 @@
|
|||
token-set-selected?
|
||||
token-set-active?
|
||||
on-create-token-set
|
||||
on-select]
|
||||
on-select
|
||||
context]
|
||||
:as _props}]
|
||||
(let [{:keys [editing? new? on-edit on-create on-reset]} (sets-context/use-context)]
|
||||
(let [{:keys [editing? new? on-edit on-create on-reset]} (or context (sets-context/use-context))]
|
||||
[:ul {:class (stl/css :sets-list)}
|
||||
(for [[id token-set] token-sets]
|
||||
[:& sets-tree {:key id
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
|
||||
(def context (mf/create-context initial))
|
||||
|
||||
(def static-context
|
||||
{:editing? (constantly false)
|
||||
:new? false
|
||||
:on-edit (constantly nil)
|
||||
:on-create (constantly nil)
|
||||
:on-reset (constantly nil)})
|
||||
|
||||
(mf/defc provider
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
|
|
Loading…
Reference in a new issue