This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-28
Channels
- # announcements (1)
- # beginners (183)
- # boot (2)
- # clara (4)
- # cljs-dev (20)
- # clojure (59)
- # clojure-dev (7)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-sg (1)
- # clojure-spec (4)
- # clojure-uk (15)
- # clojurescript (77)
- # clr (1)
- # data-science (9)
- # datomic (23)
- # docs (3)
- # duct (15)
- # emacs (8)
- # events (1)
- # fulcro (6)
- # instaparse (3)
- # juxt (1)
- # lumo (9)
- # off-topic (18)
- # perun (2)
- # portkey (13)
- # reagent (2)
- # reitit (11)
- # ring (10)
- # shadow-cljs (158)
- # tools-deps (34)
@kwladyka This is how I got withStyles
working.
(defn with-styles [styles]
(->> styles
(transform-keys keyword->PasCamelCase)
clj->js
js/MaterialUIStyles.withStyles))
(defn ->styled [styles component-name]
(let [style-fn (with-styles styles)]
(-> (gobj/get js/MaterialUI component-name)
style-fn
r/adapt-react-class)))
(def red-bg {:root {:background-color "red"}})
(def red-btn (->styled red-bg "Button"))
However I didn’t yet find a way to create a function where I can pass Reagent component created with adapt-react-class
to a style-hoc-creator-whatever function. I tried reactifying the component with no success. I’m not sure if it’s possible to easily achieve something like this with the withStyles
approach:
[with-styles { … }
[my-component-1 { … }]
[my-component-2 { … }]]
🍺 4