mirror of
https://github.com/penpot/penpot.git
synced 2025-07-30 06:29:30 +02:00
commit
08a11929ca
8 changed files with 59 additions and 5 deletions
|
@ -214,7 +214,11 @@
|
|||
:select-on-focus true
|
||||
:on-change on-change}]
|
||||
[:div.buttons
|
||||
[:input.btn-primary {:type "button" :value "Post" :on-click on-submit*}]
|
||||
[:input.btn-primary {:type "button"
|
||||
:value "Post"
|
||||
:on-click on-submit*
|
||||
:disabled (or (fm/all-spaces? @content)
|
||||
(str/empty-or-nil? @content))}]
|
||||
[:input.btn-secondary {:type "button" :value "Cancel" :on-click on-cancel}]]]))
|
||||
|
||||
(mf/defc comment-item
|
||||
|
|
|
@ -400,7 +400,7 @@
|
|||
|
||||
[:div.modal-footer
|
||||
[:div.action-buttons
|
||||
(when (or (= :analyzing (:status @state)) pending-import?)
|
||||
(when (= :analyzing (:status @state))
|
||||
[:input.cancel-button
|
||||
{:type "button"
|
||||
:value (tr "labels.cancel")
|
||||
|
|
|
@ -35,6 +35,13 @@
|
|||
{:to-prop "background"
|
||||
:format #(uc/color->background (shape->color shape))}))
|
||||
|
||||
(defn copy-data-format [shape format]
|
||||
(cg/generate-css-props
|
||||
shape
|
||||
fill-attributes
|
||||
{:to-prop "background-color"
|
||||
:format #(uc/color->format->background (shape->color shape) format)}))
|
||||
|
||||
(mf/defc fill-block [{:keys [shape]}]
|
||||
(let [color-format (mf/use-state :hex)
|
||||
color (shape->color shape)]
|
||||
|
@ -43,7 +50,7 @@
|
|||
[:& color-row {:color color
|
||||
:format @color-format
|
||||
:on-change-format #(reset! color-format %)
|
||||
:copy-data (copy-data shape)}]]))
|
||||
:copy-data (copy-data-format shape @color-format)}]]))
|
||||
|
||||
(mf/defc fill-panel
|
||||
[{:keys [shapes]}]
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
[:div.element-set-content
|
||||
[:div.row-flex
|
||||
[:& select
|
||||
{:class "flex-grow"
|
||||
{:class "flex-grow no-check"
|
||||
:default-value selected-blend-mode
|
||||
:options options
|
||||
:on-change handle-change-blend-mode
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
(ns app.util.color
|
||||
"Color conversion utils."
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.object :as obj]
|
||||
[app.util.strings :as ust]
|
||||
|
@ -150,6 +151,24 @@
|
|||
|
||||
:else "transparent")))
|
||||
|
||||
(defn color->format->background [{:keys [color opacity gradient]} format]
|
||||
(let [opacity (or opacity 1)]
|
||||
(cond
|
||||
(and gradient (not= :multiple gradient))
|
||||
(gradient->css gradient)
|
||||
|
||||
(not= color :multiple)
|
||||
(case format
|
||||
:rgba (let [[r g b] (hex->rgb color)]
|
||||
(str/fmt "rgba(%s, %s, %s, %s)" r g b opacity))
|
||||
|
||||
:hsla (let [[h s l] (hex->hsl color)]
|
||||
(str/fmt "hsla(%s, %s, %s, %s)" h (* 100 s) (* 100 l) opacity))
|
||||
|
||||
:hex (str color (str/upper (d/opacity-to-hex opacity))))
|
||||
|
||||
:else "transparent")))
|
||||
|
||||
(defn multiple? [{:keys [id file-id value color gradient]}]
|
||||
(or (= value :multiple)
|
||||
(= color :multiple)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue