mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05:00
♻️ Refactor color-name component
This commit is contained in:
parent
e60be6f262
commit
fb942a9620
1 changed files with 6 additions and 6 deletions
|
@ -40,10 +40,10 @@
|
|||
(mf/defc color-name
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [color size on-click on-double-click]}]
|
||||
(let [color (if (string? color) {:color color :opacity 1} color)
|
||||
{:keys [name color gradient]} color
|
||||
color-str (or name color (uc/gradient-type->string (:type gradient)))]
|
||||
(let [{:keys [name color gradient]} (if (string? color) {:color color :opacity 1} color)]
|
||||
(when (or (not size) (= size :big))
|
||||
[:span.color-text {:on-click #(when on-click (on-click %))
|
||||
:on-double-click #(when on-double-click (on-double-click %))
|
||||
:title name} color-str])))
|
||||
[:span.color-text
|
||||
{:on-click on-click
|
||||
:on-double-click on-double-click
|
||||
:title name}
|
||||
(or name color (uc/gradient-type->string (:type gradient)))])))
|
||||
|
|
Loading…
Add table
Reference in a new issue