0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-14 11:09:04 -05:00

🐛 Show color name when it is from the library

This commit is contained in:
Aitor 2024-02-07 15:02:05 +01:00 committed by Alonso Torres
parent f4ac607958
commit 44c4ba08b8

View file

@ -13,6 +13,37 @@
[cuerdas.core :as str] [cuerdas.core :as str]
[rumext.v2 :as mf])) [rumext.v2 :as mf]))
(defn- color-title
[color-item]
(let [name (:name color-item)
gradient (:gradient color-item)
image (:image color-item)
color (:color color-item)]
(if (some? name)
(cond
(some? color)
(str/ffmt "% (%)" name color)
(some? gradient)
(str/ffmt "% (%)" name (uc/gradient-type->string (:type gradient)))
(some? image)
(str/ffmt "% (%)" name (tr "media.image"))
:else
name)
(cond
(some? color)
color
(some? gradient)
(uc/gradient-type->string (:type gradient))
(some? image)
(tr "media.image")))))
(mf/defc color-bullet (mf/defc color-bullet
{::mf/wrap [mf/memo] {::mf/wrap [mf/memo]
::mf/wrap-props false} ::mf/wrap-props false}
@ -28,7 +59,7 @@
(if (uc/multiple? color) (if (uc/multiple? color)
[:div {:class (stl/css :color-bullet :multiple) [:div {:class (stl/css :color-bullet :multiple)
:on-click on-click :on-click on-click
:title (:color color)}] :title (color-title color)}]
;; No multiple selection ;; No multiple selection
(let [color (if (string? color) {:color color :opacity 1} color) (let [color (if (string? color) {:color color :opacity 1} color)
id (:id color) id (:id color)
@ -47,7 +78,7 @@
:read-only read-only?) :read-only read-only?)
:data-readonly (str read-only?) :data-readonly (str read-only?)
:on-click on-click :on-click on-click
:title (:color color)} :title (color-title color)}
(cond (cond
(some? gradient) (some? gradient)