Tune material-ui comments

This commit is contained in:
Juho Teperi 2020-03-22 19:05:46 +02:00
parent 019df6bbd1
commit 0644eafe59
1 changed files with 7 additions and 4 deletions

View File

@ -78,13 +78,16 @@
[:> Autocomplete {:options ["foo" "bar" "foobar"] [:> Autocomplete {:options ["foo" "bar" "foobar"]
:style {:width 300} :style {:width 300}
;; Note that the function parameter is a JS Object! ;; Note that the function parameter is a JS Object!
;; Autocomplete expects the renderInput value to be function
;; returning React elements, not a component!
;; So reactify-component won't work here.
:render-input (fn [^js params] :render-input (fn [^js params]
;; Don't call js->clj because that would ;; Don't call js->clj because that would recursively
;; recursively convert all JS objects (e.g. React ref objects) ;; convert all JS objects (e.g. React ref objects)
;; to Cljs maps, which breaks them, even when converted back to JS. ;; to Cljs maps, which breaks them, even when converted back to JS.
;; Best thing is to use r/create-element and ;; Best thing is to use r/create-element and
;; pass the JS params to it. If necessary, ;; pass the JS params to it.
;; use JS interop to modify params. ;; If necessary, use JS interop to modify params.
(set! (.-variant params) "outlined") (set! (.-variant params) "outlined")
(set! (.-label params) "Autocomplete") (set! (.-label params) "Autocomplete")
(r/create-element mui/TextField params))}]]) (r/create-element mui/TextField params))}]])