mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Show right sidebar space when one or more toolboxes are activated.
This commit is contained in:
parent
fd2bba35ce
commit
2742db8dfd
4 changed files with 65 additions and 19 deletions
|
@ -125,6 +125,7 @@
|
|||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [s {:project projectid
|
||||
:toolboxes #{}
|
||||
:page pageid}]
|
||||
(update state :workspace merge s)))
|
||||
|
||||
|
|
|
@ -21,3 +21,21 @@
|
|||
IPrintWithWriter
|
||||
(-pr-writer [mv writer _]
|
||||
(-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>"))))
|
||||
|
||||
|
||||
|
|
|
@ -37,10 +37,9 @@
|
|||
|
||||
;; Canvas
|
||||
(workarea)
|
||||
;; (working-area conn @open-toolboxes page project shapes (rum/react ws/zoom) (rum/react ws/grid?))
|
||||
;; ;; Aside
|
||||
;; (when-not (empty? @open-toolboxes)
|
||||
;; (aside conn open-toolboxes page shapes))
|
||||
|
||||
;; Aside
|
||||
;; (wa/aside)
|
||||
]]]))
|
||||
|
||||
(defn workspace-will-mount
|
||||
|
|
|
@ -207,30 +207,58 @@
|
|||
:name "viewport"
|
||||
: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
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defn working-area-render
|
||||
[own]
|
||||
(html
|
||||
[:section.workspace-canvas
|
||||
{:class "no-tool-bar"}
|
||||
#_{:class (when (empty? open-setting-boxes)
|
||||
"no-tool-bar")
|
||||
:on-scroll (constantly nil)}
|
||||
#_(when (:selected page)
|
||||
(element-options conn
|
||||
page-cursor
|
||||
project-cursor
|
||||
zoom-cursor
|
||||
shapes-cursor))
|
||||
(coordinates)
|
||||
(viewport)]))
|
||||
(let [workspace (rum/react wb/workspace-state)]
|
||||
(html
|
||||
[:section.workspace-canvas
|
||||
{:class (when (empty? (:toolboxes workspace)) "no-tool-bar")
|
||||
:on-scroll (constantly nil)}
|
||||
|
||||
#_(when (:selected page)
|
||||
(element-options conn
|
||||
page-cursor
|
||||
project-cursor
|
||||
zoom-cursor
|
||||
shapes-cursor))
|
||||
(coordinates)
|
||||
(viewport)])))
|
||||
|
||||
(def workarea
|
||||
(util/component
|
||||
{:render working-area-render
|
||||
:name "workarea"
|
||||
:mixins []}))
|
||||
:mixins [rum/reactive]}))
|
||||
|
||||
|
|
Loading…
Reference in a new issue