0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 16:00:19 -05:00

Move sidebar into separated namespace.

This commit is contained in:
Andrey Antukh 2015-12-28 15:20:16 +02:00
parent 00c2f77746
commit 77587537f6
3 changed files with 49 additions and 61 deletions

View file

@ -13,7 +13,8 @@
[uxbox.ui.workspace.pagesmngr :refer (pagesmngr)]
[uxbox.ui.workspace.header :refer (header)]
[uxbox.ui.workspace.rules :refer (h-rule v-rule)]
[uxbox.ui.workspace.workarea :refer (workarea aside)]))
[uxbox.ui.workspace.sidebar :refer (aside)]
[uxbox.ui.workspace.workarea :refer (viewport coordinates)]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Workspace
@ -21,7 +22,8 @@
(defn- workspace-render
[own projectid]
(let [workspace (rum/react wb/workspace-state)]
(let [workspace (rum/react wb/workspace-state)
no-toolbars? (empty? (:toolboxes workspace))]
(html
[:div
(header)
@ -38,10 +40,19 @@
(v-rule)
;; Canvas
(workarea)]
[:section.workspace-canvas {:class (when no-toolbars? "no-tool-bar")
:on-scroll (constantly nil)}
#_(when (:selected page)
(element-options conn
page-cursor
project-cursor
zoom-cursor
shapes-cursor))
(coordinates)
(viewport)]]
;; Aside
(when-not (empty? (:toolboxes workspace))
(when-not no-toolbars?
(aside))]])))
(defn- workspace-will-mount

View file

@ -0,0 +1,33 @@
(ns uxbox.ui.workspace.sidebar
(:require [sablono.core :as html :refer-macros [html]]
[rum.core :as rum]
[uxbox.router :as r]
[uxbox.rstore :as rs]
[uxbox.ui.mixins :as mx]
[uxbox.ui.util :as util]
[uxbox.ui.workspace.base :as wb]
[uxbox.ui.workspace.toolboxes :as toolboxes]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Aside
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn aside-render
[own]
(let [workspace (rum/react wb/workspace-state)]
(html
[:aside#settings-bar.settings-bar
[:div.settings-bar-inside
(when (:draw-toolbox-enabled workspace false)
(toolboxes/draw-tools))
(when (:icons-toolbox-enabled workspace false)
(toolboxes/icons))
(when (:layers-toolbox-enabled workspace false)
(toolboxes/layers))]])))
(def aside
(util/component
{:render aside-render
:name "aside"
:mixins [rum/reactive]}))

View file

@ -4,15 +4,10 @@
[uxbox.router :as r]
[uxbox.rstore :as rs]
[uxbox.state :as s]
[uxbox.shapes :as shapes]
[uxbox.library.icons :as _icons]
[uxbox.ui.mixins :as mx]
[uxbox.ui.util :as util]
[uxbox.data.projects :as dp]
[uxbox.ui.workspace.canvas :as wc]
[uxbox.ui.workspace.base :as wb]
[uxbox.ui.workspace.rules :as wr]
[uxbox.ui.workspace.toolboxes :as toolboxes]))
[uxbox.ui.workspace.base :as wb]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Coordinates Debug
@ -133,54 +128,3 @@
{:render viewport-render
:name "viewport"
:mixins [rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Aside
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn aside-render
[own]
(let [workspace (rum/react wb/workspace-state)]
(html
[:aside#settings-bar.settings-bar
[:div.settings-bar-inside
(when (:draw-toolbox-enabled workspace false)
(toolboxes/draw-tools))
(when (:icons-toolbox-enabled workspace false)
(toolboxes/icons))
(when (:layers-toolbox-enabled workspace false)
(toolboxes/layers))]])))
(def aside
(util/component
{:render aside-render
:name "aside"
:mixins [rum/reactive]}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Work Area
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn working-area-render
[own]
(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 [rum/reactive]}))