0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 18:48:37 -05:00

Fix inconsistencies on shapes/gradient component

This commit is contained in:
Andrey Antukh 2023-09-06 15:49:35 +02:00
parent cef74377df
commit efd4a1ffba

View file

@ -101,17 +101,22 @@
(mf/defc gradient
{::mf/wrap-props false}
[props]
(let [attr (obj/get props "attr")
shape (obj/get props "shape")
id (obj/get props "id")
id' (mf/use-ctx muc/render-id)
id (or id (dm/str (name attr) "_" id'))
(let [attr (unchecked-get props "attr")
shape (unchecked-get props "shape")
id (unchecked-get props "id")
rid (mf/use-ctx muc/render-id)
id (if (some? id)
id
(dm/str (name attr) "_" rid))
gradient (get shape attr)
gradient-props #js {:id id
:gradient gradient
:shape shape}]
(when gradient
(case (d/name (:type gradient))
"linear" [:> linear-gradient gradient-props]
"radial" [:> radial-gradient gradient-props]
props #js {:id id
:gradient gradient
:shape shape}]
(when (some? gradient)
(case (:type gradient)
:linear [:> linear-gradient props]
:radial [:> radial-gradient props]
nil))))