hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-01-10T07:07:24.000025Z

@flyboarder otoh i have a component that is a basic wrapper around the stripe API that is closer to those states

2018-01-10T07:07:28.000124Z

(defn credit-card-form
 [customer]
 {:pre [(j/cell? customer)]}
 (let [element (j/cell nil)
       token (stripe.api/token-cell)
       error (stripe.api/error-cell)
       source (j/cell= (stripe.customer/customer->default-source customer))
       processing? (j/cell false)]
  ; Once we have a token from Stripe we need to ship it to our backend for
  ; processing.
  (h/do-watch
   token
   (fn [_ n]
    (when-let [tok-str (:id n)]
     (stripe.wire/token->customer! customer tok-str))))

  (h/form
   :class "stripe-form"
   ; <https://stripe.com/docs/elements#create-token>
   :submit (fn [event]
            (wheel.dom.events/prevent-default event)
            (reset! processing? true)
            (stripe.api/create-token
             @element
             (fn [result]
              (j/dosync
               (reset! error (oops.core/oget result "?error"))
               (reset! token (oops.core/oget result "?token"))
               (reset! processing? false)))))
   (card customer element token error)
   (h/when-tpl error
    (error.hoplon/error (j/cell= (:message error))))
   (button.hoplon/normal
    :type "submit"
    :processing? processing?
    (j/cell= (str (if source "Update" "Add") " your details"))))))

2018-01-10T07:08:41.000027Z

there can be errors, and the need to process/validate externally, and concepts like a "token" that are more about data in other systems than managing the DOM state of the component itself (although it's important the component does also respond correctly to this data)

flyboarder 2018-01-10T19:54:46.000151Z

nice!

2018-01-10T22:18:49.000322Z

@flyboarder @thedavidmeister any preference on greenfield projects with hoplon for css frameworks. Matt you have both material-ui and semantic. David - any preference for you? hoplon/ui?

flyboarder 2018-01-10T22:26:59.000415Z

@donmullen currently using https://github.com/degree9/uikit-hl