Fork me on GitHub
#clojurescript
<
2021-07-21
>
ag01:07:00

Can someone point me to an example, the equivalent of something like:

class CustomizedAxisTick extends PureComponent { ... bla-bla-bla ... 
done with Reagent?

emccue01:07:09

(defn customized-axis-tick []
  [:h1 "hello"])

emccue01:07:45

@U0G75ARHC unless you were hinting toward something else

ag01:07:01

I'm trying to recreate this example in Cljs: https://recharts.org/en-US/examples/CustomizedLabelLineChart And I can't make it work

ag01:07:08

Oh, I think using reagent/as-element worked

emccue01:07:42

yep that will do it

Richard Bowen01:07:51

@thheller I take it font imports are a no go as well for shadow-cljs?

thheller05:07:16

fonts are CSS imports, so no

thheller05:07:08

just use https://fonts.google.com/ and configure the font you want and use the CSS they give you

martinklepsch13:07:07

Is there something like an observable implementation in Google Closure?

martinklepsch13:07:36

Couldn’t find anything in Closure library

Geoffrey Gaillard13:07:35

I checked a few days ago and couldn’t find anything in the closure library. Missionary (https://github.com/leonoel/missionary) has observe.

martinklepsch13:07:05

Yeah I found that and it kind of looks promising but somehow the amount of macro-magic worries me haha

martinklepsch13:07:00

probably mostly because I don’t feel like I understand macros all that well 😄

Geoffrey Gaillard14:07:05

Macros should be avoided if possible, but for something like missionary they are inevitable. So they are not a problem 🙂

athomasoriginal14:07:41

I’m experimenting with a clojure and clojurescript monorepo. One of the structures (https://gist.github.com/athomasoriginal/47913c6b946fc7416c3d839be101e600#monorepo-version-3) has a “controller deps.edn” which would contain an alias to run the cljs project app-client . Looks like this:

{:dev
  {:extra-paths ["test" "target" "tools"]
   :main-opts   ["-m"      "figwheel.main"
                 "--build" "app-client/dev"
                 "--repl"]}
I have been able to get most everything working. The last challenge appears to be that when I run the above alias, the CLJS compiler (i’m assuming it’s CLJS) can’t find my node_modules so compiling will fail. Is it possible to teach CLJS where to look for the node_modules ? Figured i’d ask here before I dig into src code. Thanks!!

dnolen15:07:32

it's not possible for node_modules to be outside of the source directory (for ClojureScript)

dnolen15:07:30

for historical reasons this is the most sound thing to do - because JS has reproducibility issues

dnolen15:07:58

while we could allow customization - this is super low priority

athomasoriginal15:07:23

Thanks. Makes sense :thumbsup:

Richard Bowen15:07:40

Hey vim users, share your vimrc with me! What plugins, if any, do you use for connect to and evaluate ClojureScript code from a repl? If you do it by hand (start the repl yourself), do share the mechanics.

Braden Shepherdson17:07:05

see the #vim channel!

Braden Shepherdson17:07:22

short answer is Fireplace! I use shadow-cljs and then :Connect 3333 and :CljEval (shadow/repl :my-build)

Drew Verlee23:07:41

Does anyone have any thoughts on https://github.com/clj-commons/cljss I'm playing around with it and it has a lot of restrictions and corner cases. I'm not sure this is avoidable given what its trying to do. Everything I have used in this space has been a bit of a headache.

dgb2308:07:07

I generally don’t like this pattern. The relation between CSS and HTML is not hierarchical it is relational and open, N:N. CSS in JS represents a special case, not a general one.

alpox09:07:24

I'm a big fan of styled-components in the javascript spectrum as we keep CSS around still and make it more dynamic. I haven't seen it being used in CLJS in a good way yet and I'm not even sure its possible given CLJS doesn't have template literals

martinklepsch09:07:23

@U0DJ4T5U1 I recently looked into this as well and there’s a few more options you might want to consider: • https://stitches.dev/https://github.com/roosta/herb I eventually just went with plain CSS but I think there’s some situations in which this can be really helpful

Drew Verlee12:07:30

@U01EFUL1A8M thanks for responding. Can you explain why you think this is hierarchical? The main functionality here in thinking of is that it transforms css data on the component into css classes. I was also hoping it would let me compose css like clojure, but given it's use of macros, that isn't the case. E.g the defstlyes macro needs to take a hashmap, not a expression that builds one.

Drew Verlee12:07:36

@U6JS7B99S I'll need to read about template literals. Thanks for the suggestion.

Drew Verlee12:07:48

@U050TNB9F I'll give those a look, thanks.

Drew Verlee12:07:40

At a glance herb looks similar to clj-commons, which is great because it's easier to understand what's possible with two implementations.

dgb2313:07:05

Maybe hierarchical is the wrong word. But as I understand it you let the dom structure dominate the styling, which is a common but special case. Or to put it in another way, if the CSS in JS approach let’s you decouple, and think in terms of, a design system, then I‘m all for it.