Fork me on GitHub
#clojurescript
<
2020-08-10
>
Risetto12:08:29

Is it possible to import a cljs namespace from a js file?

Daniel Craig21:08:46

Hi @dnolen! We've got a meetup over in #mid-cities-meetup and we're looking for speakers over the next 3 months or so. Would you be interested in proposing a topic and presenting?

Justin Roche21:08:11

How would I get a tutor? I mainly need to go through the build chain for a template, there are many pieces here...

Kasey Speakman21:08:35

I am an experienced dev but new to Clojure. I primarily work in web. I made a thing that is probably dumb -- a basic MVU loop on top of reagent -- but it would be nice to get some feedback here. https://dev.to/kspeakman/clojurescript-simple-mvu-loop-n4e

Jason23:08:32

hello. i am trying to translate material-ui js samples to cljs as a first time front end writer https://material-ui.com/components/popover/#mouse-over-interactionhave the the code i'm copying under the <>button. My best guess is

(defn hover-sample [{:keys [^js classes]}]
  (let [local-state (reagent/atom {:hover ""})]
    (fn []
      [:> Paper {:class [(.-paper classes) (.-fixedHeight classes)]}
       [:div
        [:> Typography {:id "hover-anchor"
                        :aria-owns #(if (not= "" (:hover @local-state))
                                      "mouse-over-popover"
                                      "")
                        :aria-haspopup "true"
                        :onMouseEnter #(swap! local-state assoc :hover
                                              (-> %
                                                  .-target
                                                  .-id))
                        :onMouseLeave (swap! local-state assoc :hover "")}
         "Hover with a popover"]
        [:> Popover {:id "mouse-over-popover"
                     :className (.-popover classes)
                     :classes {:paper (.-paper classes)}
                     :open #(not= "" (:hover @local-state))
                     :anchorEl #(.getElementById js/document "hover-anchor")
                     :anchorOrigin {:vertical "bottom"
                                    :horizontal "left"}
                     :transformOrigin {:vertical "top"
                                       :horizontal "left",}
                     :disableRestoreFocus true}
         [:> Typography "I use Popover."]]]])))
which renders correctly BUT the Popover is always visible, i.e. #(not= # (not= "" (:hover @local-state))) ` is always true. I am making a dumb mistake somewhere. Any help appreciated I can see the above code re-render twice when the page loads.