0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -05:00

Show right sidebar space when one or more toolboxes are activated.

This commit is contained in:
Andrey Antukh 2015-12-18 17:50:34 +02:00
parent fd2bba35ce
commit 2742db8dfd
4 changed files with 65 additions and 19 deletions

View file

@ -125,6 +125,7 @@
rs/UpdateEvent rs/UpdateEvent
(-apply-update [_ state] (-apply-update [_ state]
(let [s {:project projectid (let [s {:project projectid
:toolboxes #{}
:page pageid}] :page pageid}]
(update state :workspace merge s))) (update state :workspace merge s)))

View file

@ -21,3 +21,21 @@
IPrintWithWriter IPrintWithWriter
(-pr-writer [mv writer _] (-pr-writer [mv writer _]
(-write writer "#<event:u.s.p/toggle-tool>")))) (-write writer "#<event:u.s.p/toggle-tool>"))))
(defn toggle-toolbox
[toolname]
(reify
rs/UpdateEvent
(-apply-update [_ state]
(let [key (keyword (str (name toolname) "-enabled"))
val (get-in state [:workspace key] false)
state (assoc-in state [:workspace key] (not val))]
(if val
(update-in state [:workspace :toolboxes] disj toolname)
(update-in state [:workspace :toolboxes] conj toolname))))
IPrintWithWriter
(-pr-writer [mv writer _]
(-write writer "#<event:u.s.p/toggle-tool>"))))

View file

@ -37,10 +37,9 @@
;; Canvas ;; Canvas
(workarea) (workarea)
;; (working-area conn @open-toolboxes page project shapes (rum/react ws/zoom) (rum/react ws/grid?))
;; ;; Aside ;; Aside
;; (when-not (empty? @open-toolboxes) ;; (wa/aside)
;; (aside conn open-toolboxes page shapes))
]]])) ]]]))
(defn workspace-will-mount (defn workspace-will-mount

View file

@ -207,18 +207,46 @@
:name "viewport" :name "viewport"
:mixins [rum/reactive]})) :mixins [rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Aside
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn aside-render
[own]
(let [workspace (rum/react wb/workspace-state)]
[:aside#settings-bar.settings-bar
[:div.settings-bar-inside
[:p "foo bar"]
#_(when (:tools open-setting-boxes)
(tools open-toolboxes))
#_(when (:icons open-setting-boxes)
(icon-sets open-toolboxes))
#_(when (:components open-setting-boxes)
(components open-toolboxes components))
#_(when (:layers open-setting-boxes)
(layers conn open-toolboxes page shapes))]]))
(def aside
(util/component
{:render aside-render
:name "aside"
:mixins [rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Work Area ;; Work Area
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn working-area-render (defn working-area-render
[own] [own]
(let [workspace (rum/react wb/workspace-state)]
(html (html
[:section.workspace-canvas [:section.workspace-canvas
{:class "no-tool-bar"} {:class (when (empty? (:toolboxes workspace)) "no-tool-bar")
#_{:class (when (empty? open-setting-boxes)
"no-tool-bar")
:on-scroll (constantly nil)} :on-scroll (constantly nil)}
#_(when (:selected page) #_(when (:selected page)
(element-options conn (element-options conn
page-cursor page-cursor
@ -226,11 +254,11 @@
zoom-cursor zoom-cursor
shapes-cursor)) shapes-cursor))
(coordinates) (coordinates)
(viewport)])) (viewport)])))
(def workarea (def workarea
(util/component (util/component
{:render working-area-render {:render working-area-render
:name "workarea" :name "workarea"
:mixins []})) :mixins [rum/reactive]}))