This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-16
Channels
- # babashka (48)
- # beginners (44)
- # biff (3)
- # calva (1)
- # cider (42)
- # clj-kondo (8)
- # clojure (93)
- # clojure-australia (2)
- # clojure-europe (3)
- # clojure-taiwan (1)
- # clojurescript (10)
- # conjure (4)
- # deps-new (5)
- # joker (9)
- # lsp (12)
- # membrane (16)
- # minecraft (12)
- # missionary (4)
- # mount (3)
- # off-topic (60)
- # reitit (9)
- # releases (13)
- # ring-swagger (1)
- # shadow-cljs (18)
- # sql (67)
- # tools-deps (2)
Hi all, I just started working on re-frame. I created a class for a button and i want to add a different styling for hover state. how can i achieve that.
(defclass largeBtn
[]
{:font-size "16px"
:font-weight "bold"
:color "white"
:background-color "#7070FA"
:border-radius "4px"
:border "1px solid #5555F2"
:padding "9px 20px"
})
You do not actually need Re-frame for that. It is a local state of the button itself. So you can just create a Reagent atom that keeps track of the hoover state. The moment the user hoovers, set the value and use the trigger to update the styling.
Can't i add it to the style file i already have? not creating another class for it?
like we do in css something like &hover
You mean like something like this? Not sure if that would work. I may have made my initial answer a bit complex, since you referred to Re-frame
largeBtn:hover {
background-color: yellow;
}
:hover
is a pseudo-class, and pseudo-classes cannot be used in inline styles. And Reagent can only generate inline styles.
So you either have to use CSS (maybe regular CSS, maybe some CSS-in-JS solution - doesn't matter here), or you have to change the inline styles according to some ratom, as vanelsas mentions above.
How to extend a protocol to clojurescript collections generically? If I have a protocol, for example:
(defprotocol MyProto
(myfun []))
and I extend it as such:
(extend-protocol MyProto
IMap
(myfun [] :result)
)
the following doesn't work:
(myfun {})
=> No protocol method MyProto.myfun defined for type cljs.core/PersistentArrayMap
even though I can see that (satisfies? IMap {}) => true
Hence my question, how do I extend myfun
to maps generically without having to keep up with clojurescript internals (i.e. the various map implementations)?
Thank you in advance for your advice!this question has been asked a few times in the last month. here's the current wisdom https://clojurians.slack.com/archives/C07UQ678E/p1641410630296000
For ClojureScript 1.11.4
when trying to do an advanced build I get the following warning.
goog/i18n/numberformat.js:963:8: ERROR - [JSC_LANGUAGE_FEATURE] This language feature is only supported for ECMASCRIPT_2019 mode or better: Optional catch binding.
963| } catch {
^
I have a workaround and the question was raised in https://ask.clojure.org/index.php/11426/optional-catch-binding-problem-in-recent-versions as well, but just curious if this known? Thanks!this question has been asked a few times in the last month. here's the current wisdom https://clojurians.slack.com/archives/C07UQ678E/p1641410630296000