Closed kfigiela closed 3 months ago
Great, thanks for this!
I feel like the name cls_
is confusing, because it's not really an alternative to the cls
constructor, it's an alternative to addClass
. What do you think about naming it something like addClass_
or addClassName
? It helps communicate that it's not setting the entire class attribute, just adding a single class (it handles spaces for you, etc)
Yeah, naming is hard. Personally, I'd pick something short as this is going to be used a lot if user decides to use external CSS. How about externalClass
or extClass
so it's harder to confuse?
Let's go with extClass
since it'll be used frequently
Adjusted & force pushed
In response to the question in the other PR https://github.com/seanhess/web-view/pull/3#discussion_r1638420071 this helper makes it easier to add classes to HTML elements that are defined in 3rd party CSS. This is what I've been using in my project. Alternatively,
IsString
instance could be added toClass
soaddClass
can be used directly. This however, can cause some confusion for people who will use web-view "as prescribed", as it'd be pretty easy to confuseaddClass $ cls "foo" & prop "foo" "bar"
withaddClass "foo" & prop "foo" "bar"