improved two major forms.
This commit is contained in:
@@ -1,108 +1,34 @@
|
||||
(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.forms.builder :as form-builder]))
|
||||
[auto-ap.forms.builder :as form-builder]
|
||||
[auto-ap.views.components.level :as level]))
|
||||
|
||||
(defn address-field [{:keys [event field subscription]}]
|
||||
[:span
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Address"]
|
||||
[bind-field
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:placeholder "1700 Pennsylvania Ave"
|
||||
:field (conj field :street1)
|
||||
:spec ::address/street1
|
||||
:event event
|
||||
:subscription subscription}]]]]
|
||||
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:placeholder "Suite 400"
|
||||
:field (conj field :street2)
|
||||
:spec ::address/street2
|
||||
:event event
|
||||
:subscription subscription}]]]]
|
||||
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "City"]
|
||||
[bind-field
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:placeholder "Cupertino"
|
||||
:field (conj field :city)
|
||||
:spec ::address/city
|
||||
:event event
|
||||
:subscription subscription}]]]
|
||||
[:div.control
|
||||
[:p.help "State"]
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:placeholder "CA"
|
||||
:field (conj field :state)
|
||||
:spec ::address/state
|
||||
:size 2
|
||||
:max-length "2"
|
||||
:event event
|
||||
:subscription subscription}]]]
|
||||
[:div.control
|
||||
[:p.help "Zip"]
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field (conj field :zip)
|
||||
:spec ::address/zip
|
||||
:event event
|
||||
:subscription subscription
|
||||
:placeholder "95014"}]]]]])
|
||||
|
||||
(defn address2-field []
|
||||
[:span
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
(defn address2-field [{:keys [value on-change]}]
|
||||
[form-builder/virtual-builder {:value (or value {})
|
||||
:on-change on-change}
|
||||
[:div
|
||||
[form-builder/field-v2 {:field :street1}
|
||||
[:p.help "Street 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"
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:placeholder "1700 Pennsylvania Ave"}]]
|
||||
[form-builder/raw-field-v2 {:field :street2}
|
||||
[:input.input.is-expanded {:type "text"
|
||||
:placeholder "Suite 400"}]]
|
||||
[level/left-stack
|
||||
[form-builder/field-v2 {:field :city}
|
||||
[:p.help "City"]
|
||||
[: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"}]]]]])
|
||||
:field [:city]
|
||||
:spec ::address/city}]]
|
||||
[form-builder/field-v2 {:field :state}
|
||||
[:p.help "State"]
|
||||
[:input.input {:type "text"
|
||||
:placeholder "CA"
|
||||
:size 2
|
||||
:max-length "2"}]]
|
||||
[form-builder/field-v2 {:field :zip}
|
||||
[:p.help "Zip"]
|
||||
[:input.input {:type "text"
|
||||
:placeholder "95014"}]]]]])
|
||||
|
||||
Reference in New Issue
Block a user