UI tweaks for row show/hiding

- Make whole row clickable
- Remove cursor pointer: https://medium.com/simple-human/buttons-shouldnt-have-a-hand-cursor-b11e99ca374b
- Add hover effect for hovering over a row
This commit is contained in:
Daniel Compton 2017-08-23 11:15:18 +12:00
parent fd21fec4e5
commit 97a73aeeb9
2 changed files with 21 additions and 13 deletions

View File

@ -152,18 +152,19 @@
show-row? (get-in @trace-detail-expansions [:overrides id]
(:show-all? @trace-detail-expansions))
#_#__ (js/console.log (devtools/header-api-call tags))]
(list [:tr {:key id
:style {:color (case op-type
:sub/create "green"
:sub/run "#fd701e"
:event "blue"
:render "purple"
:re-frame.router/fsm-trigger "#fd701e"
nil)}}
[:td {:style (merge row-style {:cursor "pointer"})
:on-click #(swap! trace-detail-expansions update-in [:overrides id]
(fn [bool] (if show-row? false (not bool))))}
(if show-row? "▼" "▶")]
(list [:tr {:key id
:on-click (fn [ev]
(swap! trace-detail-expansions update-in [:overrides id]
#(if show-row? false (not %))))
:style {:color (case op-type
:sub/create "green"
:sub/run "#fd701e"
:event "blue"
:render "purple"
:re-frame.router/fsm-trigger "#fd701e"
nil)}}
[:td {:style row-style}
[:button (if show-row? "▼" "▶")]]
[:td {:style row-style} (str op-type)]
[:td {:style row-style} (if (= PersistentVector (type (js->clj operation)))
(second operation)
@ -232,8 +233,10 @@
[:thead>tr
[:th [:button.text-button
{:style {:cursor "pointer"}
:on-click (fn [e]
:on-click (fn [ev]
;; Always reset expansions
(swap! trace-detail-expansions assoc :overrides {})
;; Then toggle :show-all?
(swap! trace-detail-expansions update :show-all? not))}
(if (:show-all? @trace-detail-expansions) "-" "+")]]
[:th "operations"]

View File

@ -9,6 +9,11 @@
#--re-frame-trace-- tbody {
color: #aaa;
}
#--re-frame-trace-- tr:hover {
transition: all 0.1s ease-out;
background: aliceblue;
filter: brightness(90%);
}
#--re-frame-trace-- tr:nth-child(even) {
background: aliceblue;
}