Skip to content

Commit

Permalink
Render unevaluated results in grey
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Oct 28, 2023
1 parent 4f04542 commit 1677b14
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/src/re_frame/docs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,24 @@
(str/join "\n" (cons (.-message v)
(sci/format-stacktrace (sci/stacktrace v)))))

(defn success? [eval-result] (#{:success :success-promise} (:status eval-result)))
(defn success? [eval-result]
(when eval-result
(contains? #{:success :success-promise} (:status eval-result))))

(def green-check [:span {:style {:color "green"}} ""])
(def red-x [:span {:style {:color "red"}} ""])
(def grey [:span {:style {:color "grey"}} ""])

(defn pass-fail [pass?] (if pass? green-check red-x))
(defn pass-fail [pass?] (if (nil? pass?) grey (if pass? green-check red-x)))

(defn editor-result [{:keys [return-str] :as eval-result}
& [{:keys [format]}]]
(let [pass? (success? eval-result)
format (or format :full)]
[:div {:style {:white-space "pre-wrap"
:padding "1px 4px 0.5px 4px"
:background-color (if pass? "#eeffee" "#ffeeee")
:background-color (if (nil? pass?) "lightgrey"
(if pass? "#eeffee" "#ffeeee"))
:color "#444"
:font-family "monospace"}}
[:span {:style {:pointer-events "none"
Expand Down

0 comments on commit 1677b14

Please sign in to comment.