Form builder as a way to simplify some things

This commit is contained in:
2022-07-14 22:08:03 -07:00
parent 99fe24ddae
commit 586978823e
6 changed files with 760 additions and 640 deletions

View File

@@ -1,6 +1,7 @@
(ns auto-ap.views.components.address
(:require [auto-ap.entities.address :as address]
[auto-ap.views.utils :refer [dispatch-value-change dispatch-event bind-field horizontal-field]]))
[auto-ap.views.utils :refer [dispatch-value-change dispatch-event bind-field horizontal-field]]
[auto-ap.forms.builder :as form-builder]))
(defn address-field [{:keys [event field subscription]}]
[:span
@@ -58,3 +59,50 @@
:event event
:subscription subscription
:placeholder "95014"}]]]]])
(defn address2-field []
[:span
[horizontal-field
nil
[:div.control
[:p.help "Address"]
[form-builder/raw-field
[:input.input.is-expanded {:type "text"
:placeholder "1700 Pennsylvania Ave"
:field [:street1]
:spec ::address/street1}]]]]
[horizontal-field
nil
[:div.control
[form-builder/raw-field
[:input.input.is-expanded {:type "text"
:placeholder "Suite 400"
:field [:street2]
:spec ::address/street2}]]]]
[horizontal-field
nil
[:div.control
[:p.help "City"]
[form-builder/raw-field
[:input.input.is-expanded {:type "text"
:placeholder "Cupertino"
:field [:city]
:spec ::address/city}]]]
[:div.control
[:p.help "State"]
[form-builder/raw-field
[:input.input {:type "text"
:placeholder "CA"
:field [:state]
:spec ::address/state
:size 2
:max-length "2"}]]]
[:div.control
[:p.help "Zip"]
[form-builder/raw-field
[:input.input {:type "text"
:field [:zip]
:spec ::address/zip
:placeholder "95014"}]]]]])