In reagent, one can specify inline CSS styles like this:
[:div {:style {:border "1px solid red"}} "My Text"]
garden can make such CSS properties containing several values in a list more generic. Vectors for comma separated lists and nested vectors (used here) for space separated lists:
(require '[garden.core :refer [style]])
(style {:border [[:1px :solid :black]]})
;= "border: 1px solid red;"
How can those things be combined? Reagent seems to be stubborn only accepting hash-maps for the style attribute. Accepting a string as well would be a solution here.
Generally, of inline-styles aren't a good choice in a long term. So one could solve that by attaching a class to the div
and by specifying its style globally by gardens css
function.
Class Example:
[:div.myclass "My Text"]
(css [:.myclass {:border [[:1px :solid :black]]}])
;= ".myclass {\n border: 1px solid black;\n}"
However, sometimes it's good to start with inline styles, so: Is there a way to do it the way that is described above?