0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 20:39:09 -05:00
penpot/frontend/uxbox/ui/workspace/lateralmenu.cljs

52 lines
1.7 KiB
Text
Raw Normal View History

2015-12-18 17:42:42 +02:00
(ns uxbox.ui.workspace.lateralmenu
2015-12-17 17:32:06 +02:00
(:require [sablono.core :as html :refer-macros [html]]
[rum.core :as rum]
[cats.labs.lens :as l]
[uxbox.rstore :as rs]
[uxbox.state :as s]
[uxbox.data.workspace :as dw]
[uxbox.ui.workspace.base :as wb]
2015-12-17 17:32:06 +02:00
[uxbox.ui.icons :as i]
[uxbox.ui.util :as util]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-12-18 17:42:42 +02:00
;; Lateral Menu
2015-12-17 17:32:06 +02:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- toggle-toolbox
[state item]
(update state item (fnil not false)))
2015-12-18 17:42:42 +02:00
(defn lateralmenu-render
2015-12-17 17:32:06 +02:00
[own]
(let [workspace (rum/react wb/workspace-state)
2015-12-18 17:42:42 +02:00
toggle #(rs/emit! (dw/toggle-toolbox %))]
2015-12-17 17:32:06 +02:00
(html
[:div#tool-bar.tool-bar
[:div.tool-bar-inside
[:ul.main-tools
[:li.tooltip
{:alt "Shapes (Ctrl + Shift + F)"
:class (when (:draw-toolbox-enabled workspace false) "current")
:on-click (partial toggle :draw)}
2015-12-17 17:32:06 +02:00
i/shapes]
[:li.tooltip
{:alt "Icons (Ctrl + Shift + I)"
:class (when (:icons-toolbox-enabled workspace false) "current")
:on-click (partial toggle :icons)}
2015-12-17 17:32:06 +02:00
i/icon-set]
[:li.tooltip
{:alt "Elements (Ctrl + Shift + L)"
:class (when (:layers-toolbox-enabled workspace false) "current")
:on-click (partial toggle :layers)}
2015-12-17 17:32:06 +02:00
i/layers]
[:li.tooltip
{:alt "Feedback (Ctrl + Shift + M)"}
i/chat]]]])))
2015-12-18 17:42:42 +02:00
(def ^:static lateralmenu
2015-12-17 17:32:06 +02:00
(util/component
2015-12-18 17:42:42 +02:00
{:render lateralmenu-render
:name "lateralmenu"
2015-12-17 17:32:06 +02:00
:mixins [rum/reactive]}))