mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 18:48:37 -05:00
🐛 Show color name when it is from the library
This commit is contained in:
parent
f4ac607958
commit
44c4ba08b8
1 changed files with 33 additions and 2 deletions
|
@ -13,6 +13,37 @@
|
|||
[cuerdas.core :as str]
|
||||
[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/wrap [mf/memo]
|
||||
::mf/wrap-props false}
|
||||
|
@ -28,7 +59,7 @@
|
|||
(if (uc/multiple? color)
|
||||
[:div {:class (stl/css :color-bullet :multiple)
|
||||
:on-click on-click
|
||||
:title (:color color)}]
|
||||
:title (color-title color)}]
|
||||
;; No multiple selection
|
||||
(let [color (if (string? color) {:color color :opacity 1} color)
|
||||
id (:id color)
|
||||
|
@ -47,7 +78,7 @@
|
|||
:read-only read-only?)
|
||||
:data-readonly (str read-only?)
|
||||
:on-click on-click
|
||||
:title (:color color)}
|
||||
:title (color-title color)}
|
||||
|
||||
(cond
|
||||
(some? gradient)
|
||||
|
|
Loading…
Add table
Reference in a new issue