mirror of
https://github.com/penpot/penpot.git
synced 2025-07-27 21:17:23 +02:00
⚡ Add missing use-memo on page-menu
This commit is contained in:
parent
01268ea14e
commit
8f37cd2c07
2 changed files with 10 additions and 8 deletions
|
@ -116,7 +116,7 @@
|
||||||
:shared-libs shared-libs}]
|
:shared-libs shared-libs}]
|
||||||
|
|
||||||
(= 0 (count selected))
|
(= 0 (count selected))
|
||||||
[:& page/options]
|
[:> page/options*]
|
||||||
|
|
||||||
(= 1 (count selected))
|
(= 1 (count selected))
|
||||||
[:> shape-options*
|
[:> shape-options*
|
||||||
|
|
|
@ -24,14 +24,18 @@
|
||||||
(-> (l/key :background)
|
(-> (l/key :background)
|
||||||
(l/derived refs/workspace-page)))
|
(l/derived refs/workspace-page)))
|
||||||
|
|
||||||
(mf/defc options
|
(mf/defc options*
|
||||||
{::mf/wrap [mf/memo]
|
{::mf/wrap [mf/memo]}
|
||||||
::mf/wrap-props false}
|
|
||||||
[]
|
[]
|
||||||
(let [background (mf/deref ref:background-color)
|
(let [background (mf/deref ref:background-color)
|
||||||
on-change (mf/use-fn #(st/emit! (dw/change-canvas-color %)))
|
on-change (mf/use-fn #(st/emit! (dw/change-canvas-color %)))
|
||||||
on-open (mf/use-fn #(st/emit! (dwu/start-undo-transaction :options)))
|
on-open (mf/use-fn #(st/emit! (dwu/start-undo-transaction :options)))
|
||||||
on-close (mf/use-fn #(st/emit! (dwu/commit-undo-transaction :options)))]
|
on-close (mf/use-fn #(st/emit! (dwu/commit-undo-transaction :options)))
|
||||||
|
|
||||||
|
color (mf/with-memo [background]
|
||||||
|
{:color (d/nilv background clr/canvas)
|
||||||
|
:opacity 1})]
|
||||||
|
|
||||||
[:div {:class (stl/css :element-set)}
|
[:div {:class (stl/css :element-set)}
|
||||||
[:div {:class (stl/css :element-title)}
|
[:div {:class (stl/css :element-title)}
|
||||||
[:& title-bar {:collapsable false
|
[:& title-bar {:collapsable false
|
||||||
|
@ -39,14 +43,12 @@
|
||||||
:class (stl/css :title-spacing-page)}]]
|
:class (stl/css :title-spacing-page)}]]
|
||||||
[:div {:class (stl/css :element-content)}
|
[:div {:class (stl/css :element-content)}
|
||||||
|
|
||||||
;; FIXME: memoize color
|
|
||||||
[:> color-row*
|
[:> color-row*
|
||||||
{:disable-gradient true
|
{:disable-gradient true
|
||||||
:disable-opacity true
|
:disable-opacity true
|
||||||
:disable-image true
|
:disable-image true
|
||||||
:title (tr "workspace.options.canvas-background")
|
:title (tr "workspace.options.canvas-background")
|
||||||
:color {:color (d/nilv background clr/canvas)
|
:color color
|
||||||
:opacity 1}
|
|
||||||
:on-change on-change
|
:on-change on-change
|
||||||
:on-open on-open
|
:on-open on-open
|
||||||
:on-close on-close}]]]))
|
:on-close on-close}]]]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue