This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-05
Channels
- # aws-lambda (1)
- # beginners (294)
- # boot (35)
- # cider (19)
- # cljs-dev (39)
- # cljsrn (7)
- # clojars (48)
- # clojure (266)
- # clojure-android (1)
- # clojure-brasil (1)
- # clojure-france (2)
- # clojure-greece (5)
- # clojure-italy (7)
- # clojure-mexico (1)
- # clojure-russia (24)
- # clojure-spec (10)
- # clojure-uk (31)
- # clojurescript (134)
- # consulting (7)
- # cursive (69)
- # datomic (20)
- # emacs (57)
- # events (2)
- # figwheel (2)
- # hoplon (1)
- # jobs-discuss (19)
- # luminus (33)
- # lumo (18)
- # mount (1)
- # off-topic (32)
- # om (5)
- # onyx (27)
- # pedestal (15)
- # re-frame (12)
- # reagent (28)
- # rum (2)
- # schema (2)
- # spacemacs (9)
- # unrepl (2)
- # untangled (7)
- # vim (5)
- # yada (4)
I am having a very positive initial experience with semantic-ui. I am tired of bootstrap. semantic-ui has a material theme too, which looks really sweet.
For anyone interested in semantic ui components, there is https://github.com/gadfly361/soda-ash
@jfntn Here are a couple options if your need is in the context of a reagent component:
(defonce app-state
(reagent/atom {:count 0}))
(defn foo [ratom]
(let [count (get @ratom :count)
_side-effect (js/console.log count)]
[:div
[:div
(str "The current count is " count)]
[:button {:on-click #(swap! ratom update :count inc)}
"Increment count"]]))
(defn bar [ratom]
(reagent/create-class
{:reagent-render (fn [ratom]
(let [count (get @ratom :count)]
[:div
[:div
(str "The current count is " count)]
[:button {:on-click #(swap! ratom update :count inc)}
"Increment count"]]))
:component-did-mount #(js/console.log (:count @ratom))
:component-did-update #(js/console.log (:count @ratom))}))
@gadfly361 thanks but I’m trying to implement it as an fx in re-frame so I don’t have a component to tie into
interesting, I wasn't aware of track!
make sure you don't abuse it 🙂
well, usually with React, all site "activity" is handled in one of the lifecycle methods
by introducing direct side-effects of changes to ratoms, you sort of break that paradigm IMO
that could be a clever hack (i.e. pragmatism) or if used excessively could make data flow hard to follow
I can imagine a lot of non-abusive uses for track! by the way
Been trying to get this code reviewed if you want to take a look https://github.com/Day8/re-frame/issues/255#issuecomment-299370790
@gadfly361 I’m playing with soda-ash
right now, and I’m wondering what the “right” way to trigger a modal is (within reagent). I can use [sa/Modal {:trigger (reagent/as-element [sa/Button "Log in!"])} ...]
, or I can do something like have no trigger, have [sa/Modal {:open true}]
then force the component in through a global :modal
ratom that controls stuff that way. Is there a canonical way, a right way, a preferred way? Or just… “whatever.” If it’s whatever, or the first way (with a trigger and the component within the declaration of the modal, then what’s the right anonymous function to close the modal?)
@gadfly361 thanks!
@jfntn I think either of the following are perfectly legitimate ways to go about this. The second version is more 'reagenty' - I used a ratom that is attached to the component, but it can also be your global app-state or app-db if you are using re-frame.
(defn modal-with-trigger []
[sa/Modal {:trigger (reagent/as-element [sa/Button "Modal"])
:close-icon true}
[sa/ModalHeader "Select a Photo"]
[sa/ModalContent {:image true}
[sa/Image {:wrapped true
:size "medium"
:src ""}]
[sa/ModalDescription
[sa/Header "Default Profile Image"]
[:p "We've found the following gravatar image associated with your e-mail address."]
[:p "Is it okay to use this photo?"]
]]])
(defn modal-with-ratom []
(let [modal-ratom (reagent/atom false)]
(fn []
(let [open? @modal-ratom]
[:div
[sa/Button
{:on-click #(reset! modal-ratom true)}
"Modal 2"]
[sa/Modal
{:open open?
:close-icon true
:on-close #(reset! modal-ratom false)}
[sa/ModalHeader "Select a Photo"]
[sa/ModalContent {:image true}
[sa/Image {:wrapped true
:size "medium"
:src ""}]
[sa/ModalDescription
[sa/Header "Default Profile Image"]
[:p "We've found the following gravatar image associated with your e-mail address."]
[:p "Is it okay to use this photo?"]
]]]]))))
@gadfly361 thanks so much!