reagent

2023-04-05T13:43:06.615319Z

Would the following keys within sx get manipulated (as in converted to camel case?)

[list {:sx {"--List-item-radius" "8px" "--List-item-minHeight" "32px" "--List-gap" "4px"}} ...]
These properties are not showing up and I don't know how to debug it.

2023-04-05T13:43:38.765789Z

And if that's the case (and I presume it might be), what to do so it doesn't happen?

p-himik 2023-04-05T13:48:42.055039Z

Strings are preserved. I'd try adding #js in front of the inner map literal.

p-himik 2023-04-05T13:51:07.074209Z

Although I'm pretty sure that the inner map will get converted to a JS object either way, assuming you got that list by using adapt-react-class. In that case, it might be that your selectors are not valid. It seems like MUI, and IIRC it has a way of setting global and/or local prefixes for selectors within components, so maybe that's why it doesn't work.

2023-04-05T14:05:19.246309Z

Yeah list comes from adapt-react-class, exactly. It is MUI (Joy UI actually, whatever, same thing).

2023-04-05T14:07:34.680419Z

The selectors should be valid, I copied it from their example project https://mui.com/joy-ui/getting-started/templates/order-dashboard/#some-link

2023-04-05T14:09:26.295709Z

Anyway thanks @p-himik. I'll try without the selector, setting the props directly on list-item is probably easier to understand anyway. MUI/Joy UI is nice, but it's very bloody complex.

p-himik 2023-04-05T14:13:35.762829Z

Yeah, with MUI reading all of the documentation is pretty much a must. I'm still using Material UI v4 and I do not look forward to having to update to v5. Or to v6, which is apparently now a thing.

2023-04-05T14:14:54.778119Z

Oh man, that sounds like a pain. It tends to fail silently without any explanations. I really dislike that.

p-himik 2023-04-05T14:16:04.847159Z

Eh, in this case you're (apparently? no clue) passing data that's just something extra. In the vast majority of scenarios, any Clojure function that accepts a map of options would also simply ignore that data without complaining.

2023-04-05T14:21:35.641709Z

Yeah I know CLJ does that also. So far that hasn't been a problem, but in MUI I found it challenging: do I get the selector wrong? Has the key been improperly translated (kebab/camel case)? Did I forget to clj->js? Reagent translates automatically say for {:sx {{}}, but not for {:sx (fn [])}. I spent a good few hours before I figured that one out, since MUI wouldn't tell me "this is not the data I expect to get".

2023-04-05T14:24:47.318609Z

I prefer this approach over the selectors:

+  (defn menu-button [route & chidren]
+    [list-item {:sx {:border-radius 8}}
+     [list-item-button {:on-click (close-sidebar-and-go route)}]
+     children])
Less brittle. Just putting it on list-item (rather than a selector on list).

👍 1
hifumi123 2023-04-05T17:33:18.122379Z

v6 isnt out yet except for MUI X and the changes are quite minimal -- you now have more granular components like a dedicated clock / time picker, but otherwise most of the API has stayed the same

👍 1
hifumi123 2023-04-05T17:36:54.150699Z

it probably wont be a other year or two for mui v6 since they plan to refactor @mui/material to build atop headless components in @mui/base, and tenatively planned implementation of material design v3