mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
54 lines
2.0 KiB
Clojure
54 lines
2.0 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
;; defined by the Mozilla Public License, v. 2.0.
|
|
;;
|
|
;; Copyright (c) 2020 UXBOX Labs SL
|
|
|
|
(ns app.main.ui.viewer.handoff.attributes
|
|
(:require
|
|
[rumext.alpha :as mf]
|
|
[app.util.i18n :as i18n]
|
|
[app.common.geom.shapes :as gsh]
|
|
[app.main.ui.viewer.handoff.attributes.layout :refer [layout-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.fill :refer [fill-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.stroke :refer [stroke-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.shadow :refer [shadow-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.blur :refer [blur-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.image :refer [image-panel]]
|
|
[app.main.ui.viewer.handoff.attributes.text :refer [text-panel]]))
|
|
|
|
(def type->options
|
|
{:multiple [:fill :stroke :image :text :shadow :blur]
|
|
:frame [:layout :fill]
|
|
:group [:layout]
|
|
:rect [:layout :fill :stroke :shadow :blur]
|
|
:circle [:layout :fill :stroke :shadow :blur]
|
|
:path [:layout :fill :stroke :shadow :blur]
|
|
:curve [:layout :fill :stroke :shadow :blur]
|
|
:image [:image :layout :shadow :blur]
|
|
:text [:layout :text :shadow :blur]})
|
|
|
|
(mf/defc attributes
|
|
[{:keys [shapes frame]}]
|
|
(let [locale (mf/deref i18n/locale)
|
|
shapes (->> shapes (map #(gsh/translate-to-frame % frame)))
|
|
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
|
|
options (type->options type)]
|
|
[:div.element-options
|
|
(for [option options]
|
|
[:> (case option
|
|
:layout layout-panel
|
|
:fill fill-panel
|
|
:stroke stroke-panel
|
|
:shadow shadow-panel
|
|
:blur blur-panel
|
|
:image image-panel
|
|
:text text-panel)
|
|
{:shapes shapes
|
|
:frame frame
|
|
:locale locale}])]))
|
|
|