This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-10
Channels
- # adventofcode (3)
- # aws (2)
- # beginners (85)
- # boot (8)
- # boot-dev (4)
- # cider (36)
- # clara (3)
- # cljs-dev (87)
- # cljsrn (3)
- # clojure (87)
- # clojure-austin (12)
- # clojure-brasil (1)
- # clojure-dev (8)
- # clojure-dusseldorf (5)
- # clojure-estonia (5)
- # clojure-greece (4)
- # clojure-italy (3)
- # clojure-spec (17)
- # clojure-uk (55)
- # clojurescript (70)
- # core-logic (2)
- # cursive (6)
- # data-science (18)
- # datomic (13)
- # emacs (34)
- # fulcro (347)
- # graphql (12)
- # hoplon (6)
- # jobs (3)
- # jobs-discuss (43)
- # juxt (2)
- # keechma (31)
- # leiningen (29)
- # lumo (2)
- # midje (2)
- # off-topic (118)
- # om-next (4)
- # onyx (39)
- # pedestal (6)
- # re-frame (85)
- # reagent (21)
- # remote-jobs (3)
- # ring (5)
- # rum (2)
- # shadow-cljs (126)
- # spacemacs (1)
- # sql (6)
@flyboarder otoh i have a component that is a basic wrapper around the stripe API that is closer to those states
(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"
;
: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"))))))
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)
nice!
@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?
@donmullen currently using https://github.com/degree9/uikit-hl