mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
Additional work on colors page.
This commit is contained in:
parent
5d7379ec32
commit
5fb93ad5fd
5 changed files with 66 additions and 130 deletions
|
@ -21,14 +21,30 @@
|
|||
;; Events
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn merge-if-not-exists
|
||||
[map & maps]
|
||||
(let [result (transient map)]
|
||||
(loop [maps maps]
|
||||
(if-let [nextval (first maps)]
|
||||
(do
|
||||
(run! (fn [[key value]]
|
||||
(when-not (contains? result key)
|
||||
(assoc! result key value)))
|
||||
nextval)
|
||||
(recur (rest maps)))
|
||||
(persistent! result)))))
|
||||
|
||||
(defn initialize
|
||||
[section]
|
||||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc state :dashboard {:section section
|
||||
:collection-type :builtin
|
||||
:collection-id nil}))
|
||||
(as-> state $
|
||||
(assoc-in $ [:dashboard :section] section)
|
||||
(update $ :dashboard merge-if-not-exists
|
||||
{:collection-type :builtin
|
||||
:collection-id 1})))
|
||||
|
||||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
(-write writer "#<event:u.d.d/initialize>"))))
|
||||
|
@ -36,16 +52,21 @@
|
|||
(defn set-collection-type
|
||||
[type]
|
||||
{:pre [(contains? #{:builtin :own} type)]}
|
||||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(as-> state $
|
||||
(assoc-in $ [:dashboard :collection-type] type)
|
||||
(assoc-in $ [:dashboard :collection-id] nil)))
|
||||
(letfn [(select-first [state]
|
||||
(if (= type :builtin)
|
||||
(assoc-in state [:dashboard :collection-id] 1)
|
||||
(let [coll (sort-by :id (vals (:colors-by-id state)))]
|
||||
(assoc-in state [:dashboard :collection-id] (:id (first coll))))))]
|
||||
(reify
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(as-> state $
|
||||
(assoc-in $ [:dashboard :collection-type] type)
|
||||
(select-first $)))
|
||||
|
||||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
(-write writer "#<event:u.d.d/set-collection-type>"))))
|
||||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
(-write writer "#<event:u.d.d/set-collection-type>")))))
|
||||
|
||||
(defn set-collection
|
||||
[id]
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
(defonce state (atom {}))
|
||||
|
||||
(defonce stream
|
||||
(rs/init {:user {:fullname "Cirilla"
|
||||
(rs/init {:user {:fullname "Cirilla Fiona"
|
||||
:avatar "http://lorempixel.com/50/50/"}
|
||||
:dashboard {}
|
||||
:workspace {}
|
||||
|
|
|
@ -1,36 +1,32 @@
|
|||
(ns uxbox.ui.dashboard.builtins)
|
||||
|
||||
(def ^:static +colors+
|
||||
(def ^:static +color-collections+
|
||||
[{:name "Generic 1"
|
||||
:id 1
|
||||
:colors
|
||||
[{:hex "00f9ff"}
|
||||
{:hex "009fff"}
|
||||
{:hex "0078ff"}
|
||||
{:hex "005eff"}
|
||||
{:hex "0900ff"}
|
||||
{:hex "7502f1"}
|
||||
{:hex "ffe705"}
|
||||
{:hex "00ffab"}
|
||||
{:hex "f52105"}
|
||||
{:hex "7502f1"}
|
||||
{:hex "ffe705"}
|
||||
{:hex "00ffab"}
|
||||
{:hex "f52105"}]}
|
||||
:colors #{:00f9ff
|
||||
:009fff
|
||||
:0078ff
|
||||
:005eff
|
||||
:0900ff
|
||||
:7502f1
|
||||
:ffe705
|
||||
:00ffab
|
||||
:f52105
|
||||
}}
|
||||
{:name "Generic 2"
|
||||
:id 2
|
||||
:colors
|
||||
[{:hex "00f9ff"}
|
||||
{:hex "009fff"}
|
||||
{:hex "0078ff"}
|
||||
{:hex "005eff"}
|
||||
{:hex "0900ff"}
|
||||
{:hex "7502f1"}
|
||||
{:hex "ffe705"}
|
||||
{:hex "00ffab"}
|
||||
{:hex "f52105"}
|
||||
{:hex "7502f1"}
|
||||
{:hex "ffe705"}
|
||||
{:hex "00ffab"}
|
||||
{:hex "f52105"}]}])
|
||||
:colors #{:00f9ff
|
||||
:009fff
|
||||
:0078ff
|
||||
:005eff
|
||||
:0900ff
|
||||
:7502f1
|
||||
:ffe705
|
||||
:00ffab
|
||||
:f52105
|
||||
}}])
|
||||
|
||||
(def ^:static +color-collections-by-id+
|
||||
(let [data (transient {})]
|
||||
(run! #(assoc! data (:id %) %) +color-collections+)
|
||||
(persistent! data)))
|
||||
|
|
|
@ -77,14 +77,16 @@
|
|||
builtin? (= (:collection-type dashboard) :builtin)
|
||||
collections (if own?
|
||||
(sort-by :id (vals colors))
|
||||
builtins/+colors+)]
|
||||
builtins/+color-collections+)]
|
||||
(html
|
||||
[:div.library-bar
|
||||
[:div.library-bar-inside
|
||||
[:ul.library-tabs
|
||||
[:li (when builtin? {:class-name "current"})
|
||||
[:li {:class-name (when builtin? "current")
|
||||
:on-click #(rs/emit! (dd/set-collection-type :builtin))}
|
||||
"STANDARD"]
|
||||
[:li (when own? {:class-name "current"})
|
||||
[:li {:class-name (when own? "current")
|
||||
:on-click #(rs/emit! (dd/set-collection-type :own))}
|
||||
"YOUR LIBRARIES"]]
|
||||
[:ul.library-elements
|
||||
;; (when own?
|
||||
|
|
87
profiles.clj
87
profiles.clj
|
@ -19,7 +19,7 @@
|
|||
|
||||
:back
|
||||
[:common
|
||||
{:source-paths ["src/backend"]
|
||||
{:source-paths ["backend"]
|
||||
:test-paths ["test/backend"]
|
||||
:dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
|
||||
[org.slf4j/slf4j-simple "1.7.12" :scope "provided"]
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
:front
|
||||
[:common
|
||||
{:source-paths ["src/frontend"]
|
||||
{:source-paths ["frontend"]
|
||||
:test-paths ["test/frontend"]
|
||||
:dependencies [[org.clojure/clojurescript "1.7.189"]
|
||||
[funcool/cuerdas "0.7.0"]
|
||||
|
@ -49,86 +49,3 @@
|
|||
[bidi "1.21.0"]
|
||||
[funcool/hodgepodge "0.1.4"]]}]}
|
||||
|
||||
;; :plugins [[lein-cljsbuild "1.1.0" :exclusions [org.clojure/clojure]]
|
||||
;; [lein-figwheel "0.3.9" :exclusions [org.clojure/clojurescript
|
||||
;; org.codehaus.plexus/plexus-utils]]
|
||||
;; [hiccup-bridge "1.0.1" :exclusions [org.clojure/clojure]]]
|
||||
|
||||
|
||||
;; :cljsbuild
|
||||
;; {:builds [{:id "dev"
|
||||
;; :source-paths ["src/frontend" "test/frontend"]
|
||||
|
||||
;; :figwheel { :on-jsload "uxbox.core/on-js-reload" }
|
||||
|
||||
;; :compiler {:main uxbox.core
|
||||
;; :asset-path "/js/compiled/out"
|
||||
;; :output-to "resources/public/js/compiled/uxbox.js"
|
||||
;; :output-dir "resources/public/js/compiled/out"
|
||||
;; :source-map-timestamp true
|
||||
;; :warnings {:single-segment-namespace false}
|
||||
;; :externs ["externs/bacon.js"]
|
||||
;; :foreign-libs [{:file "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.js"
|
||||
;; :file-min "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.min.js"
|
||||
;; :provides ["bacon"]}]}}
|
||||
|
||||
;; {:id "test"
|
||||
;; :source-paths ["src" "test"]
|
||||
;; :notify-command ["node" "out/tests.js"]
|
||||
;; :compiler {:output-to "out/tests.js"
|
||||
;; :output-dir "out"
|
||||
;; :source-map true
|
||||
;; :static-fns true
|
||||
;; :cache-analysis false
|
||||
;; :main uxbox.runner
|
||||
;; :optimizations :none
|
||||
;; :target :nodejs
|
||||
;; :pretty-print true
|
||||
;; :warnings {:single-segment-namespace false}
|
||||
;; :externs ["externs/bacon.js"]
|
||||
;; :foreign-libs [{:file "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.js"
|
||||
;; :file-min "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.min.js"
|
||||
;; :provides ["bacon"]}]}}
|
||||
|
||||
;; {:id "min"
|
||||
;; :source-paths ["src"]
|
||||
;; :compiler {:output-to "resources/public/js/compiled/uxbox.js"
|
||||
;; :main uxbox.core
|
||||
;; :optimizations :advanced
|
||||
;; :pretty-print false
|
||||
;; :warnings {:single-segment-namespace false}
|
||||
;; :externs ["externs/bacon.js"]
|
||||
;; :foreign-libs [{:file "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.js"
|
||||
;; :file-min "http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.min.js"
|
||||
;; :provides ["bacon"]}]}}]}
|
||||
|
||||
;; :figwheel
|
||||
;; {;; :http-server-root "public" ;; default and assumes "resources"
|
||||
;; ;; :server-port 3449 ;; default
|
||||
;; :css-dirs ["resources/public/css"] ;; watch and update CSS
|
||||
|
||||
;; ;; Start an nREPL server into the running figwheel process
|
||||
;; :nrepl-port 7888
|
||||
|
||||
;; ;; Server Ring Handler (optional)
|
||||
;; ;; if you want to embed a ring handler into the figwheel http-kit
|
||||
;; ;; server, this is for simple ring servers, if this
|
||||
;; ;; doesn't work for you just run your own server :)
|
||||
;; :ring-handler uxbox.ring/index
|
||||
|
||||
;; ;; To be able to open files in your editor from the heads up display
|
||||
;; ;; you will need to put a script on your path.
|
||||
;; ;; that script will have to take a file path and a line number
|
||||
;; ;; ie. in ~/bin/myfile-opener
|
||||
;; ;; #! /bin/sh
|
||||
;; ;; emacsclient -n +$2 $1
|
||||
;; ;;
|
||||
;; ;; :open-file-command "myfile-opener"
|
||||
|
||||
;; ;; if you want to disable the REPL
|
||||
;; ;; :repl false
|
||||
|
||||
;; ;; to configure a different figwheel logfile path
|
||||
;; ;; :server-logfile "tmp/logs/figwheel-logfile.log"
|
||||
;; }}
|
||||
;; ]}
|
||||
|
|
Loading…
Add table
Reference in a new issue