mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 09:08:31 -05:00
💄 Use new spread-props helper on submit-button* component
This commit is contained in:
parent
04540c4b0f
commit
46070c2987
1 changed files with 9 additions and 10 deletions
|
@ -287,13 +287,13 @@
|
|||
|
||||
(mf/defc submit-button*
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [on-click children label form class-name name disabled] :as props}]
|
||||
[{:keys [on-click children label form class name disabled] :as props}]
|
||||
(let [form (or form (mf/use-ctx form-ctx))
|
||||
|
||||
disabled? (or (and (some? form) (not (:valid @form)))
|
||||
(true? disabled))
|
||||
|
||||
class (dm/str (d/nilv class-name "btn-primary btn-large")
|
||||
class (dm/str (d/nilv class "btn-primary btn-large")
|
||||
" "
|
||||
(if disabled? (stl/css :btn-disabled) ""))
|
||||
|
||||
|
@ -307,14 +307,13 @@
|
|||
(on-click event))))
|
||||
|
||||
props
|
||||
(-> (obj/clone props)
|
||||
(obj/set! "children" mf/undefined)
|
||||
(obj/set! "disabled" disabled?)
|
||||
(obj/set! "onKeyDown" on-key-down)
|
||||
(obj/set! "name" name)
|
||||
(obj/set! "label" mf/undefined)
|
||||
(obj/set! "className" class)
|
||||
(obj/set! "type" "submit"))]
|
||||
(mf/spread-props props {:children mf/undefined
|
||||
:disabled disabled?
|
||||
:on-key-down on-key-down
|
||||
:name name
|
||||
:labek mf/undefined
|
||||
:class class
|
||||
:type "submit"})]
|
||||
|
||||
[:> "button" props
|
||||
(if (some? children)
|
||||
|
|
Loading…
Add table
Reference in a new issue