Fork me on GitHub
#reagent
<
2017-10-17
>
dhirensr06:10:18

hey how can we convert this into cljs $(window).load(function() { $(this).joyride(); }) and i tried it like this :component-did-mount #(.load (jq/$ "window") (fn [] (.joyride (jq/$ "#first")))) but it's not working. can any one tell whats the right way?

p-himik09:10:32

@achikin Does anything change when you wrap the returned hiccup in a function?

p-himik09:10:59

@dhirensr I think for load you can just write (set! (.-onload js/window) main) anywhere (the main being your lambda). As for the joyride - you should replace jq with js. Also, I see you replaced this with "#first" - you should be able to use this inside component-did-mount: (fn [] (this-as this (.joyride (js/$ this)))).

mkvlr09:10:06

is there something to convert hiccup for use in reagent and vice versa?

p-himik09:10:44

@mkvlr "Reagent extends standard Hiccup in one way: it is possible to "squeeze" elements together by using a > character." If that's the only difference, writing a function to do this should be pretty simple. Or are there any other differences?

pesterhazy10:10:11

@mkvlr what's your use case?

mkvlr11:10:59

@pesterhazy our pedestal app would like to share some view code with our re-frame app

pesterhazy11:10:19

my gut feeling is that that's probably more complex than it's worth for a little duplication

pesterhazy11:10:56

at least if the views container any dynamic elements

mkvlr11:10:34

hmmm, that’s not what I was hoping for…

mkvlr11:10:57

we rewrote our elixir code in clojure in order to share it with our re-frame app…

pesterhazy11:10:30

I think it depends on the extend and nature of the template sharing

mkvlr11:10:24

@pesterhazy you think as long as it’s pure functions that return markup it should be fine?

mkvlr11:10:17

are the differences to hiccup written down somewhere? We noticed the :style attribute being different for example…

pesterhazy12:10:27

@mkvlr the differences are pretty minor

pesterhazy12:10:46

but reagent is based on react, which does a bunch of thing internally

pesterhazy12:10:07

e.g. normalize attributes

pesterhazy12:10:13

@mkvlr actually I filed an issue about style some time ago and it looks like james got around to implementing it in the meantime 🙂 https://github.com/weavejester/hiccup/issues/136

mkvlr12:10:14

@pesterhazy oh, that’s good to know, thanks!

cjsauer14:10:46

Is reagent able to do any conditional stylesheet loading? For example, I'd like to load the minified version in prod, but non-min in development. The reagent template has these things specified in a static index.html file, so I'm wondering how I'd pull this off..

borkdude14:10:22

What’s with the “frisk” naming? First re-frisk and now https://github.com/Odinodin/data-frisk-reagent. Does it have a meaning I’m not aware of in English?

borkdude14:10:38

Awesome library btw

pesterhazy16:10:24

@borkdude "to search (a person) for concealed weapons, contraband goods, etc., by feeling the person's clothing" I'm guessing

pesterhazy16:10:36

as in police inspection 🙂

dhirensr18:10:04

@p-himik: Thanks for the reply