@currentoor: nice I've already written something very similar to boostrap.cljs there
@currentoor: so you append "Ui" right for the factory function?
@currentoor: it's too bad I can't get the @ReactClass syntax to work in advanced mode
i liked the syntax, but I suppose I can type 1 more character
@jasonjckn: yeah i've copied over that bootstrap macro too many times from project to project now 😄
your syntax does look cooler though but yeah i don't mind typing one extra character
i'm definitely going to steal some stuff from aum.cljc
nice 😄
it's on clojars by the way
my syntax also helped for writing generic code, e.g:
(def tabui-list
[ListingsTab
BookingsTab
MessagesTab
ReportsTab
TXJTab
SpaceTransferTab
InviteUserTab
CreateBookingTab
NewCollectionsTab])
(def which-tab->tabui
(zipmap (map #(:which-tab (initial-state % nil)) tabui-list)
tabui-list))
(defui TabUnion (map-vals get-query which-tab->tabui)
static Ident
(ident [T {:keys [which-tab]}] [which-tab :tab])
static InitialAppState
(initial-state [_ _] (initial-state MessagesTab))
Object
(navbar [T which-tab]
(nav {:bsStyle "pills"
:stacked true
:class "nav"
:activeKey which-tab
:onSelect #(transact! T [(app/choose-tab {:tab (keyword %)})
(history/commit)
:ui/react-key])}
(for [[which-tab tabui] which-tab->tabui]
(nav-item {:eventKey which-tab} (tab-title tabui)))))
(render [T]
(let [{:keys [which-tab]} (props T)]
(div
(.navbar T which-tab)
(div {:id "tabunion_content"}
(@(which-tab->tabui which-tab) (props T)))))))
if you have any good ideas i'm open to suggestions
so
(@(which-tab->tabui which-tab)
is harder to do with the "Ui" syntaxyeah definitely, i'm trying to think of how i would do that
@currentoor: i was thinking of putting props as an argument into render function for sugar reasons
oh my god yes!
i've had the same thought every time i write a render method!
just been too lazy
i want destructuring to still work though
yah, i just have higher priority stuff, so haven't bothered to do it
i've done something kind of similar in clojure land by wrapping an anonymous function, otherwise generic destructuring didn't work
use a let ?
(let [args [k# env# pull-result#]] @body)
i think i tried that initially but namespaced keywords didn't behave correctly
k
either way, if you get to it first definitely let me know, i'd love to add props as an argument to the render method
would you add computed props and props as 2 arguments?
it'd be cool to make render variadic and allow (render [this]...)
or (render [this props]...)
or (render [this props state]...)
hmm, hadn't thought of computed props
yah something doesn't quite feel right about all this sugar
maybe because protocols can't be variadic
true
@tony.kay: https://github.com/untangled-web/untangled-spec/pull/4/files PR
i cheated while debugging this, I copied the CLJS code into CLJ , then ran Cider debugger on it and stepped through the code line by line 🙂
i suppose I could have used chrome dev tools as well to debug it
not sure it has locals though
@adambros: Anthony, mind taking a look at his PR?