mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -05:00
🐛 Fix team modal auto focus handling.
This commit is contained in:
parent
eacc945254
commit
231a133f23
1 changed files with 12 additions and 13 deletions
|
@ -62,20 +62,19 @@
|
||||||
(st/emit! (dd/update-team (with-meta team mdata))
|
(st/emit! (dd/update-team (with-meta team mdata))
|
||||||
(modal/hide))))
|
(modal/hide))))
|
||||||
|
|
||||||
(mf/defc team-form-modal
|
(defn- on-submit
|
||||||
{::mf/register modal/components
|
[form _]
|
||||||
|
(let [data (:clean-data @form)]
|
||||||
|
(if (:id data)
|
||||||
|
(on-update-submit form)
|
||||||
|
(on-create-submit form))))
|
||||||
|
|
||||||
|
(mf/defc team-form-modal {::mf/register modal/components
|
||||||
::mf/register-as :team-form}
|
::mf/register-as :team-form}
|
||||||
[{:keys [team] :as props}]
|
[{:keys [team] :as props}]
|
||||||
(let [form (fm/use-form :spec ::team-form
|
(let [initial (mf/use-memo (fn [] (or team {})))
|
||||||
:initial (or team {}))
|
form (fm/use-form :spec ::team-form
|
||||||
|
:initial initial)]
|
||||||
on-submit
|
|
||||||
(mf/use-callback
|
|
||||||
(mf/deps team)
|
|
||||||
(if team
|
|
||||||
(partial on-update-submit form)
|
|
||||||
(partial on-create-submit form)))]
|
|
||||||
|
|
||||||
[:div.modal-overlay
|
[:div.modal-overlay
|
||||||
[:div.modal-container.team-form-modal
|
[:div.modal-container.team-form-modal
|
||||||
[:& fm/form {:form form :on-submit on-submit}
|
[:& fm/form {:form form :on-submit on-submit}
|
||||||
|
@ -91,7 +90,7 @@
|
||||||
|
|
||||||
[:div.modal-content.generic-form
|
[:div.modal-content.generic-form
|
||||||
[:& fm/input {:type "text"
|
[:& fm/input {:type "text"
|
||||||
:auto-focus true
|
:auto-focus? true
|
||||||
:form form
|
:form form
|
||||||
:name :name
|
:name :name
|
||||||
:label (tr "labels.create-team.placeholder")}]]
|
:label (tr "labels.create-team.placeholder")}]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue