Does anyone have or know of any examples of using spec with reagent views?
Hey @jayzawrotny, I'm a little late to the party, but I found this blog post to be very apropos https://juxt.pro/blog/cljs-apps
Thanks @lanejo01
@jayzawrotny I do have one example from a commercial app I've worked on for the last few years:
(s/fdef dre.components.widget/widget
:args
(s/and
(s/cat
:opts
(s/keys
:req-un [::title ;; title in header
::content ;; Contents to show in widget. It must be a Hiccup
;; vector. Widget does not support varying arguments in
;; content, they are for initialization only.
]
:opt-un [::id ;; unique identifier for widget (page wide, not app
;; wide)
::icon ;; icon to show in header
::widget-class ;; CSS class
::collapsable? ;; If it can be collapsed
::init-collapsed? ;; initialize the widget in a collapsed
;; state?
::help ;; help contents which are shown in modal
::controls ;; Arbitrary component rendered in the
;; header. What it does is up to you.
::selections ;; coll of dropdown/tabs
::dropdown ;; convenience option, singular version of
;; selections with
;; {:type :dropdown, :id :dropdown} by default
::tabs ;; convenience option, singular version of selections
;; with {:type :tabs, :id :tabs}
::loading? ;; Whether or not to display a loading indicator
::locked? ;; Whether or not content modifications are possible
::menu ;; menu
::on-will-unmount]))
(fn [{:keys [opts]}]
(if-let [unexpected
(seq (apply dissoc opts expected-keys))]
(do
(warn "Unexpected options" unexpected)
false)
true))))
@jayzawrotny This is about the only Reagent component I've spec-ed because it has so many options
Not sure if it's useful, but this is the app: http://covid19.doctorevidence.com/ (this is a free preview of it)
Thanks @borkdude this really helps!