0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 11:38:24 -05:00

🐛 Remove copy all button in fills and strokes

This commit is contained in:
Eva 2023-01-27 12:54:18 +01:00 committed by Alejandro Alonso
parent e7ddd6055f
commit 15e62ff649
3 changed files with 25 additions and 24 deletions

View file

@ -314,11 +314,15 @@
} }
} }
.attributes-shadow-block { .attributes-shadow-block,
.attributes-stroke-block,
.attributes-fill-block {
border-top: 1px solid $color-gray-60; border-top: 1px solid $color-gray-60;
} }
.attributes-shadow-blocks :first-child { .attributes-shadow-blocks :first-child,
.attributes-stroke-blocks :first-child,
.attributes-fill-blocks :first-child {
border-top: none; border-top: none;
} }
} }

View file

@ -6,7 +6,6 @@
(ns app.main.ui.viewer.inspect.attributes.fill (ns app.main.ui.viewer.inspect.attributes.fill
(:require (:require
[app.main.ui.components.copy-button :refer [copy-button]]
[app.main.ui.viewer.inspect.attributes.common :refer [color-row]] [app.main.ui.viewer.inspect.attributes.common :refer [color-row]]
[app.util.code-gen :as cg] [app.util.code-gen :as cg]
[app.util.color :as uc] [app.util.color :as uc]
@ -40,10 +39,11 @@
(let [color-format (mf/use-state :hex) (let [color-format (mf/use-state :hex)
color (shape->color shape)] color (shape->color shape)]
[:& color-row {:color color [:div.attributes-fill-block
:format @color-format [:& color-row {:color color
:on-change-format #(reset! color-format %) :format @color-format
:copy-data (copy-data shape)}])) :on-change-format #(reset! color-format %)
:copy-data (copy-data shape)}]]))
(mf/defc fill-panel (mf/defc fill-panel
[{:keys [shapes]}] [{:keys [shapes]}]
@ -51,14 +51,13 @@
(when (seq shapes) (when (seq shapes)
[:div.attributes-block [:div.attributes-block
[:div.attributes-block-title [:div.attributes-block-title
[:div.attributes-block-title-text (tr "inspect.attributes.fill")] [:div.attributes-block-title-text (tr "inspect.attributes.fill")]]
(when (= (count shapes) 1)
[:& copy-button {:data (copy-data (first shapes))}])]
(for [shape shapes] [:div.attributes-fill-blocks
(for [shape shapes]
(if (seq (:fills shape)) (if (seq (:fills shape))
(for [value (:fills shape [])] (for [value (:fills shape [])]
[:& fill-block {:key (str "fill-block-" (:id shape) value) [:& fill-block {:key (str "fill-block-" (:id shape) value)
:shape value}]) :shape value}])
[:& fill-block {:key (str "fill-block-only" (:id shape)) [:& fill-block {:key (str "fill-block-only" (:id shape))
:shape shape}]))]))) :shape shape}]))]])))

View file

@ -55,12 +55,7 @@
[{:keys [shape]}] [{:keys [shape]}]
(let [color-format (mf/use-state :hex) (let [color-format (mf/use-state :hex)
color (shape->color shape)] color (shape->color shape)]
[:* [:div.attributes-stroke-block
[:& color-row {:color color
:format @color-format
:copy-data (copy-color-data shape)
:on-change-format #(reset! color-format %)}]
(let [{:keys [stroke-style stroke-alignment]} shape (let [{:keys [stroke-style stroke-alignment]} shape
stroke-style (if (= stroke-style :svg) :solid stroke-style) stroke-style (if (= stroke-style :svg) :solid stroke-style)
stroke-alignment (or stroke-alignment :center)] stroke-alignment (or stroke-alignment :center)]
@ -78,7 +73,11 @@
;; inspect.attributes.stroke.alignment.inner ;; inspect.attributes.stroke.alignment.inner
;; inspect.attributes.stroke.alignment.outer ;; inspect.attributes.stroke.alignment.outer
[:div.attributes-label (->> stroke-alignment d/name (str "inspect.attributes.stroke.alignment.") (tr))] [:div.attributes-label (->> stroke-alignment d/name (str "inspect.attributes.stroke.alignment.") (tr))]
[:& copy-button {:data (copy-stroke-data shape)}]])])) [:& copy-button {:data (copy-stroke-data shape)}]])
[:& color-row {:color color
:format @color-format
:copy-data (copy-color-data shape)
:on-change-format #(reset! color-format %)}]]))
(mf/defc stroke-panel (mf/defc stroke-panel
[{:keys [shapes]}] [{:keys [shapes]}]
@ -86,14 +85,13 @@
(when (seq shapes) (when (seq shapes)
[:div.attributes-block [:div.attributes-block
[:div.attributes-block-title [:div.attributes-block-title
[:div.attributes-block-title-text (tr "inspect.attributes.stroke")] [:div.attributes-block-title-text (tr "inspect.attributes.stroke")]]
(when (= (count shapes) 1)
[:& copy-button {:data (copy-stroke-data (first shapes))}])]
(for [shape shapes] [:div.attributes-stroke-blocks
(for [shape shapes]
(if (seq (:strokes shape)) (if (seq (:strokes shape))
(for [value (:strokes shape [])] (for [value (:strokes shape [])]
[:& stroke-block {:key (str "stroke-color-" (:id shape) value) [:& stroke-block {:key (str "stroke-color-" (:id shape) value)
:shape value}]) :shape value}])
[:& stroke-block {:key (str "stroke-color-only" (:id shape)) [:& stroke-block {:key (str "stroke-color-only" (:id shape))
:shape shape}]))]))) :shape shape}]))]])))