Fork me on GitHub
#reagent
<
2017-10-13
>
cmal07:10:48

Hi! Is there a way to set some css psuedo classes selector in reagent node(.cljs file), in the :style property? just want the code to do dynamic calculations on those psuedo-classes by operating clojurescript.

gadfly36108:10:52

@cmal i don't think psuedo classes work in the :style property, but you can use garden (https://github.com/noprompt/garden) and add a dynamic [:style ...] tag

cmal08:10:31

@gadfly361 So I should generate css strings and add it to a style tag, but where should the style tag be put? If I put it under the #app node, will it apply to the whole html page?

juhoteperi08:10:41

@cmal <style> will always apply to whole page

cmal08:10:21

@fingerzam ahh, Thank you!

pesterhazy08:10:42

doesn't <style> need to appear in the header?

pesterhazy08:10:26

@cmal, this looks relevant to your use case https://github.com/roman01la/cljss

pesterhazy08:10:57

it's useful to read up on "styled components" in JS land (links in @roman01la's readme)

cmal08:10:43

It seems <style> in html5 can be in body.

pesterhazy08:10:08

I have a feeling that styled components is the way to go for the future (i.e. more or less inline styles only)

pesterhazy08:10:21

it works very well for react native

cmal08:10:01

thheller told me that https://github.com/thheller/shadow/wiki/shadow.markup might works for this, too.

cmal09:10:00

@pesterhazy where did the injected css goes, for cljss? in the <script> tag in header?

pesterhazy09:10:14

I imagine so

cmal09:10:20

It seems similar to shadow.markup. I will try it.

pesterhazy09:10:07

report back if you like it

Petrus Theron09:10:02

Why am I getting this create-react-class error using reagent 0.7.0?

No such namespace: cljsjs.create-react-class, could not locate cljsjs/create_react_class.cljs, cljsjs/create_react_class.cljc, or JavaScript source providing "cljsjs.create-react-class"

Petrus Theron09:10:54

OK, managed to get around this by adding an empty ns for it

Petrus Theron09:10:31

fixed with: (ns cljsjs.create-react-class)

Roman Liutikov10:10:28

@cmal Hi. cljss puts styles into a style tag in head

Roman Liutikov10:10:07

Also don’t forget to add {:closure-defines {“goog.DEBUG” false}} to compiler config when building for production to enable fast path

tatut11:10:48

there’s also https://github.com/Jarzka/stylefy which is neat for reagent apps

juhoteperi12:10:33

I wonder if it could be just removed, I think the only place it is used, is to show the path in error messages

juhoteperi12:10:46

Or maybe there is better way to implement this, without accessing internals

colindresj14:10:49

Bringing this up again, because I haven’t found a good way — does anyone know of an idiomatic way to extend a JS class in clojurescript? The java counterparts don’t seem to work well with es6 classes

kennytilton14:10:12

@mikethompson Thx! I think I am confusing myself by sometimes testing this via Reagent. Just now in Reagent I managed to get a listener on a span tho the one on an input tag did not show. Anyway, thx again for confirming the React behavior.

iGEL15:10:06

Hello! Is there a way to turn a hiccup like data structure into a string with the html with reagent (or re-frame)?

sb17:10:03

@U3UDMF5ME could you tell to us with different words?

rgdelato20:10:51

I think they're asking if there's a way to convert hiccup to an HTML string

rgdelato16:10:13

I think you might have to use hiccups if you need it to work client-side

iGEL07:10:48

Thanks for the replies. A bit unfortunate that I reagent can't do this, but I guess hiccups (the cljs thingy) is what I need. 🙂

sb19:10:28

Sorry, for my late reply. I think, do you need reagent-sente solution. I did in the past.