0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

Merge pull request #4038 from penpot/ladybenko-6515-fix-privacy-checkbox

🐛 Fix accept privacy terms checkbox
This commit is contained in:
Eva Marco 2024-01-23 17:31:25 +01:00 committed by GitHub
commit c7ac3b0163
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -253,6 +253,7 @@
[:& fm/input {:name :accept-terms-and-privacy
:class "check-primary"
:type "checkbox"
:default-checked false
:label terms-label}]]))
[:> fm/submit-button*

View file

@ -31,7 +31,6 @@
input-name (get props :name)
more-classes (get props :class)
auto-focus? (get props :auto-focus? false)
placeholder (or placeholder label)
form (or form (mf/use-ctx form-ctx))
@ -43,6 +42,7 @@
is-text? (or (= @type' "password")
(= @type' "text")
(= @type' "email"))
placeholder (when is-text? (or placeholder label))
touched? (get-in @form [:touched input-name])
error (get-in @form [:errors input-name])
@ -87,7 +87,7 @@
(swap! form assoc-in [:touched input-name] true)))
props (-> props
(dissoc :help-icon :form :trim :children :show-success? :auto-focus?)
(dissoc :help-icon :form :trim :children :show-success? :auto-focus? :label)
(assoc :id (name input-name)
:value value
:auto-focus auto-focus?
@ -103,6 +103,7 @@
"aria-describedby" (dm/str "error-" input-name)))
(obj/clj->props))
checked? (and is-checkbox? (= value true))
show-valid? (and show-success? touched? (not error))
show-invalid? (and touched? error)]
@ -124,7 +125,7 @@
:for (name input-name)} label
(when is-checkbox?
[:span {:class (stl/css-case :global/checked value)} i/status-tick-refactor])
[:span {:class (stl/css-case :global/checked checked?)} (when checked? i/status-tick-refactor)])
(if is-checkbox?
[:> :input props]