Toggling data structures with arrows only, not body
This commit is contained in:
parent
49095dcfe3
commit
910483dd53
|
@ -456,13 +456,9 @@
|
|||
color: #8f8f8f;
|
||||
content: "}";
|
||||
}
|
||||
#--re-frame-trace-- .re-frame-trace--object:before {
|
||||
#--re-frame-trace-- .re-frame-trace--object .toggle {
|
||||
color: #8f8f8f;
|
||||
content: "▶ ";
|
||||
}
|
||||
#--re-frame-trace-- .re-frame-trace--object.expanded:before {
|
||||
color: #8f8f8f;
|
||||
content: "▼ ";
|
||||
cursor: pointer;
|
||||
}
|
||||
#--re-frame-trace-- .re-frame-trace--object > span {
|
||||
vertical-align: text-top;
|
||||
|
|
|
@ -575,14 +575,23 @@
|
|||
}
|
||||
}
|
||||
.re-frame-trace--object {
|
||||
&:before {
|
||||
.toggle {
|
||||
color: @text-color-muted;
|
||||
content: "▶ ";
|
||||
cursor: pointer;
|
||||
}
|
||||
&.expanded {
|
||||
&>span {
|
||||
vertical-align: text-top;
|
||||
}
|
||||
}
|
||||
.data-structure-editable {
|
||||
&.string {
|
||||
&:before {
|
||||
color: @text-color-muted;
|
||||
content: "▼ ";
|
||||
content: "\"";
|
||||
}
|
||||
&:after {
|
||||
color: @text-color-muted;
|
||||
content: "\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,15 @@
|
|||
|
||||
(defn data-structure
|
||||
[jsonml]
|
||||
(let [expand? (r/atom true)]
|
||||
(let [expanded? (r/atom true)]
|
||||
(fn [jsonml]
|
||||
[:span
|
||||
{:class (str/join " " ["re-frame-trace--object"
|
||||
(when @expand? "expanded")])
|
||||
:on-click #(swap! expand? not)}
|
||||
(jsonml->hiccup (if @expand?
|
||||
(when @expanded? "expanded")])}
|
||||
[:span {:class "toggle"
|
||||
:on-click #(swap! expanded? not)}
|
||||
(if @expanded? "▼" "▶")]
|
||||
(jsonml->hiccup (if @expanded?
|
||||
(cljs-devtools/body-api-call
|
||||
(.-object (get jsonml 1))
|
||||
(.-config (get jsonml 1)))
|
||||
|
|
Loading…
Reference in New Issue