For my current project, I am utilizing Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to develop a dynamic web application.
Typically, when building the project, I initiate the command cider-jack-in-cljs in Emacs, select shadow-cljs, opt for shadow as the REPL type, and finally choose app as the build option.
Within the project's source code, you can find:
(defn splitter-panel-title
[text]
[title
:label text
:level :level3
:style {:margin-top "20px"}])
Note how the style
is presented without a direct prefix of brackets or curly braces:
:style {:margin-top "20px"}
. Less frequently seen is:
(defn left-panel
[]
[box
:size "auto"
:child [:div {:style rounded-panel}
[splitter-panel-title [:code ":panel-1"]]]])
Here, observe the use of curly braces with the style
: { :style rounded-panel }. Lastly, we also encounter:
(defn header-view []
[:div
[:div
[:style
{:type "text/css"}]]])
Notice the bracket [:style
.
Why does :style
within re-frame sometimes appear with brackets, sometimes with curly braces, and at times without any surrounding characters? Is there a specific reason behind each approach?
As far as I understand, this represents inline styling in Re-frame. The last two examples are enclosed within a div
element, but they employ different formatting methods.
Could the presence of brackets, curly braces, or absence of such be related to JavaScript and/or CSS syntax in some way?
Thank you