From e601677a9231f071f88c220028bab24f39ec4252 Mon Sep 17 00:00:00 2001 From: Gregg8 Date: Fri, 12 Jan 2018 10:39:49 +1100 Subject: [PATCH] Cleanups and added bottom radius to Subs pods when closed --- src/day8/re_frame/trace/common_styles.cljs | 4 ++- src/day8/re_frame/trace/view/app_db.cljs | 12 ++++----- src/day8/re_frame/trace/view/subs.cljs | 31 +++++++++++----------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/day8/re_frame/trace/common_styles.cljs b/src/day8/re_frame/trace/common_styles.cljs index d58317d..383bf8a 100644 --- a/src/day8/re_frame/trace/common_styles.cljs +++ b/src/day8/re_frame/trace/common_styles.cljs @@ -1,6 +1,8 @@ (ns day8.re-frame.trace.common-styles (:require [garden.units :refer [px em]])) +;; TODO: Switch these to BM (or just use BM defs if available) + (def background-blue "#e7f1ff") (def background-gray "#a8a8a8") (def background-gray-hint "#fafafa") @@ -15,7 +17,7 @@ (def light-blue "lightblue") (def light-gray "#efeef1") (def yellow "yellow") -(def text-color "#222") +(def text-color "#767A7C") ;; Was "#222" but now using bm: (def default-text-color "#767A7C") (def text-color-muted "#8f8f8f") (def event-color dark-gold) diff --git a/src/day8/re_frame/trace/view/app_db.cljs b/src/day8/re_frame/trace/view/app_db.cljs index 9ecc1c1..43963ee 100644 --- a/src/day8/re_frame/trace/view/app_db.cljs +++ b/src/day8/re_frame/trace/view/app_db.cljs @@ -1,6 +1,5 @@ (ns day8.re-frame.trace.view.app-db - (:require [clojure.string :as str] - [devtools.prefs] + (:require [devtools.prefs] [devtools.formatters.core] [day8.re-frame.trace.view.components :as components] [mranderson047.re-frame.v0v10v2.re-frame.core :as rf] @@ -20,7 +19,7 @@ (def trash (macros/slurp-macro "day8/re_frame/trace/images/trash.svg")) (def cljs-dev-tools-background "#e8ffe8") -(def pod-gap common/gs-19s) ;; or 31? +(def pod-gap common/gs-19s) (def pad-padding common/gs-7s) ;; TODO: START ========== LOCAL DATA - REPLACE WITH SUBS AND EVENTS @@ -28,16 +27,15 @@ (def *pods (r/atom [{:id (gensym) :path "[\"x\" \"y\"]" :open? true :diff? true} {:id (gensym) :path "[:abc 123]" :open? true :diff? false} {:id (gensym) :path "[:a :b :c]" :open? false :diff? true} - {:id (gensym) :path "[\"hello\"]" :open? false :diff? false}] - #_[])) + {:id (gensym) :path "[\"hello\"]" :open? false :diff? false}])) (defn add-pod [] (let [id (gensym)] - (println "Added pod" id) + ;(println "Added pod" id) (swap! *pods concat [{:id id :path "" :open? true :diff? false}]))) (defn delete-pod [id] - (println "Deleted pod" id) + ;(println "Deleted pod" id) (reset! *pods (filterv #(not= id (:id %)) @*pods))) (defn update-pod-field diff --git a/src/day8/re_frame/trace/view/subs.cljs b/src/day8/re_frame/trace/view/subs.cljs index cb6acf1..7d4d4a8 100644 --- a/src/day8/re_frame/trace/view/subs.cljs +++ b/src/day8/re_frame/trace/view/subs.cljs @@ -1,8 +1,5 @@ (ns day8.re-frame.trace.view.subs - (:require [re-frame.subs :as subs] - ;[cljs.spec.alpha :as s] - [day8.re-frame.trace.view.components :as components] - [mranderson047.re-frame.v0v10v2.re-frame.core :as rf] + (:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf] [mranderson047.reagent.v0v6v0.reagent.core :as r] [day8.re-frame.trace.utils.re-com :as rc :refer [css-join]] [day8.re-frame.trace.common-styles :as common]) @@ -18,17 +15,16 @@ (def copy (macros/slurp-macro "day8/re_frame/trace/images/copy.svg")) (def cljs-dev-tools-background "#e8ffe8") -(def pod-gap common/gs-19s) ;; or 31? +(def pod-gap common/gs-19s) (def pad-padding common/gs-7s) ;; TODO: START ========== LOCAL DATA - REPLACE WITH SUBS AND EVENTS -(def *pods (r/atom [{:id (gensym) :type :destroyed :layer "3" :path "[:todo/blah]" :open? true :diff? true} +(def *pods (r/atom [{:id (gensym) :type :destroyed :layer "3" :path "[:todo/blah]" :open? true :diff? false} {:id (gensym) :type :created :layer "3" :path "[:todo/completed]" :open? true :diff? true} - {:id (gensym) :type :re-run :layer "3" :path "[:todo/completed]" :open? true :diff? true} - {:id (gensym) :type :re-run :layer "2" :path "[:todo/blah]" :open? true :diff? true} - {:id (gensym) :type :not-run :layer "3" :path "[:todo/blah]" :open? true :diff? true}] - #_[])) + {:id (gensym) :type :re-run :layer "3" :path "[:todo/completed]" :open? true :diff? false} + {:id (gensym) :type :re-run :layer "2" :path "[:todo/blah]" :open? true :diff? false} + {:id (gensym) :type :not-run :layer "3" :path "[:todo/blah]" :open? true :diff? false}])) (defn update-pod-field [id field new-val] @@ -58,6 +54,7 @@ (defn tag [type label] [rc/box + :class "noselect" :style {:color "white" :background-color (tag-color type) :width common/gs-50s @@ -69,6 +66,7 @@ (defn title-tag [type title label] [rc/v-box + :class "noselect" :align :center :gap "2px" :children [[:span {:style {:font-size "9px"}} title] @@ -111,11 +109,14 @@ (defn pod-header [{:keys [id type layer path open? diff?]}] [rc/h-box - :class "app-db-path--header" - :style {:border-top-left-radius "3px" - :border-top-right-radius "3px"} - :align :center - :height common/gs-31s + :class "app-db-path--header" + :style (merge {:border-top-left-radius "3px" + :border-top-right-radius "3px"} + (when-not open? + {:border-bottom-left-radius "3px" + :border-bottom-right-radius "3px"})) + :align :center + :height common/gs-31s :children [[rc/box :width "36px" :height common/gs-31s