Cleanups and added bottom radius to Subs pods when closed

This commit is contained in:
Gregg8 2018-01-12 10:39:49 +11:00
parent e79fbf187c
commit e601677a92
3 changed files with 24 additions and 23 deletions

View File

@ -1,6 +1,8 @@
(ns day8.re-frame.trace.common-styles (ns day8.re-frame.trace.common-styles
(:require [garden.units :refer [px em]])) (:require [garden.units :refer [px em]]))
;; TODO: Switch these to BM (or just use BM defs if available)
(def background-blue "#e7f1ff") (def background-blue "#e7f1ff")
(def background-gray "#a8a8a8") (def background-gray "#a8a8a8")
(def background-gray-hint "#fafafa") (def background-gray-hint "#fafafa")
@ -15,7 +17,7 @@
(def light-blue "lightblue") (def light-blue "lightblue")
(def light-gray "#efeef1") (def light-gray "#efeef1")
(def yellow "yellow") (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 text-color-muted "#8f8f8f")
(def event-color dark-gold) (def event-color dark-gold)

View File

@ -1,6 +1,5 @@
(ns day8.re-frame.trace.view.app-db (ns day8.re-frame.trace.view.app-db
(:require [clojure.string :as str] (:require [devtools.prefs]
[devtools.prefs]
[devtools.formatters.core] [devtools.formatters.core]
[day8.re-frame.trace.view.components :as components] [day8.re-frame.trace.view.components :as components]
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf] [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 trash (macros/slurp-macro "day8/re_frame/trace/images/trash.svg"))
(def cljs-dev-tools-background "#e8ffe8") (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) (def pad-padding common/gs-7s)
;; TODO: START ========== LOCAL DATA - REPLACE WITH SUBS AND EVENTS ;; 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} (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 "[:abc 123]" :open? true :diff? false}
{:id (gensym) :path "[:a :b :c]" :open? false :diff? true} {: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 [] (defn add-pod []
(let [id (gensym)] (let [id (gensym)]
(println "Added pod" id) ;(println "Added pod" id)
(swap! *pods concat [{:id id :path "" :open? true :diff? false}]))) (swap! *pods concat [{:id id :path "" :open? true :diff? false}])))
(defn delete-pod [id] (defn delete-pod [id]
(println "Deleted pod" id) ;(println "Deleted pod" id)
(reset! *pods (filterv #(not= id (:id %)) @*pods))) (reset! *pods (filterv #(not= id (:id %)) @*pods)))
(defn update-pod-field (defn update-pod-field

View File

@ -1,8 +1,5 @@
(ns day8.re-frame.trace.view.subs (ns day8.re-frame.trace.view.subs
(:require [re-frame.subs :as subs] (:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
;[cljs.spec.alpha :as s]
[day8.re-frame.trace.view.components :as components]
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
[mranderson047.reagent.v0v6v0.reagent.core :as r] [mranderson047.reagent.v0v6v0.reagent.core :as r]
[day8.re-frame.trace.utils.re-com :as rc :refer [css-join]] [day8.re-frame.trace.utils.re-com :as rc :refer [css-join]]
[day8.re-frame.trace.common-styles :as common]) [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 copy (macros/slurp-macro "day8/re_frame/trace/images/copy.svg"))
(def cljs-dev-tools-background "#e8ffe8") (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) (def pad-padding common/gs-7s)
;; TODO: START ========== LOCAL DATA - REPLACE WITH SUBS AND EVENTS ;; 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 :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 "3" :path "[:todo/completed]" :open? true :diff? false}
{:id (gensym) :type :re-run :layer "2" :path "[:todo/blah]" :open? true :diff? true} {: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? true}] {:id (gensym) :type :not-run :layer "3" :path "[:todo/blah]" :open? true :diff? false}]))
#_[]))
(defn update-pod-field (defn update-pod-field
[id field new-val] [id field new-val]
@ -58,6 +54,7 @@
(defn tag [type label] (defn tag [type label]
[rc/box [rc/box
:class "noselect"
:style {:color "white" :style {:color "white"
:background-color (tag-color type) :background-color (tag-color type)
:width common/gs-50s :width common/gs-50s
@ -69,6 +66,7 @@
(defn title-tag [type title label] (defn title-tag [type title label]
[rc/v-box [rc/v-box
:class "noselect"
:align :center :align :center
:gap "2px" :gap "2px"
:children [[:span {:style {:font-size "9px"}} title] :children [[:span {:style {:font-size "9px"}} title]
@ -111,11 +109,14 @@
(defn pod-header [{:keys [id type layer path open? diff?]}] (defn pod-header [{:keys [id type layer path open? diff?]}]
[rc/h-box [rc/h-box
:class "app-db-path--header" :class "app-db-path--header"
:style {:border-top-left-radius "3px" :style (merge {:border-top-left-radius "3px"
:border-top-right-radius "3px"} :border-top-right-radius "3px"}
:align :center (when-not open?
:height common/gs-31s {:border-bottom-left-radius "3px"
:border-bottom-right-radius "3px"}))
:align :center
:height common/gs-31s
:children [[rc/box :children [[rc/box
:width "36px" :width "36px"
:height common/gs-31s :height common/gs-31s