cljss
cljss copied to clipboard
Rum issues
trafficstars
Using :css inside conditionals in rum components won't compile properly.
Here is an example of a component:
(rum/defcs a-comp < (rum/local false ::selected?)
[state]
(let [local-selected? (::selected? state)]
[:div
(if @local-selected?
[:div
{:css {:color "red"}}]
[:div
{:css {:color "green"}}])]))
And html produced by it:
<div>
<div css="[object Object]"></div>
</div>
I think im seeing the same issue, though shadow doesn't even seem to produce a build when you try this. The commented outversion that doesn't use merge works, the other does work. It seems to expect a hashmap only.
(rum/defc plant-stage-v2
[{:keys [grid-column-start grid-column-end grid-row-start grid-row-end] :as m}]
[:div {:css (merge m {:background-color :inherit
:border 0
#_#_#_#_#_#_#_#_:grid-column-start grid-column-start
:grid-column-end grid-column-end
:grid-row-start grid-row-end
:grid-row-end grid-row-end
})}
[:img {:css {:width "100%"
:height "100%"
:object-fit "cover"
#_#_:animation plusing-pink-glow
:border-radius "50%"}
:src "img/rose.png"}]])