mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
♻️ Convert text-menu and sub-components to modern rumext * format
Rename text-align-options, text-direction-options, vertical-align, grow-options, text-decoration-options and text-menu to their * variants. Update all call sites in shapes/text.cljs, shapes/group.cljs and shapes/multiple.cljs.
This commit is contained in:
parent
0e5d3e2619
commit
e9e6796f05
@ -38,7 +38,7 @@
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc text-align-options
|
||||
(mf/defc text-align-options*
|
||||
[{:keys [values on-change on-blur] :as props}]
|
||||
(let [{:keys [text-align]} values
|
||||
handle-change
|
||||
@ -70,7 +70,7 @@
|
||||
:title (tr "workspace.options.text-options.text-align-justify")
|
||||
:icon i/text-justify}]]]))
|
||||
|
||||
(mf/defc text-direction-options
|
||||
(mf/defc text-direction-options*
|
||||
[{:keys [values on-change on-blur] :as props}]
|
||||
(let [direction (:text-direction values)
|
||||
handle-change
|
||||
@ -98,7 +98,7 @@
|
||||
:title (tr "workspace.options.text-options.direction-rtl")
|
||||
:icon i/text-rtl}]]]))
|
||||
|
||||
(mf/defc vertical-align
|
||||
(mf/defc vertical-align*
|
||||
[{:keys [values on-change on-blur] :as props}]
|
||||
(let [{:keys [vertical-align]} values
|
||||
vertical-align (or vertical-align "top")
|
||||
@ -126,7 +126,7 @@
|
||||
:title (tr "workspace.options.text-options.align-bottom")
|
||||
:icon i/text-bottom}]]]))
|
||||
|
||||
(mf/defc grow-options
|
||||
(mf/defc grow-options*
|
||||
[{:keys [ids values on-blur] :as props}]
|
||||
(let [grow-type (:grow-type values)
|
||||
|
||||
@ -172,7 +172,7 @@
|
||||
:title (tr "workspace.options.text-options.grow-auto-height")
|
||||
:icon i/text-auto-height}]]]))
|
||||
|
||||
(mf/defc text-decoration-options
|
||||
(mf/defc text-decoration-options*
|
||||
[{:keys [values on-change on-blur] :as props}]
|
||||
(let [text-decoration (or (:text-decoration values) "none")
|
||||
handle-change
|
||||
@ -199,7 +199,7 @@
|
||||
:title (tr "workspace.options.text-options.strikethrough" (sc/get-tooltip :line-through))
|
||||
:icon i/text-stroked}]]]))
|
||||
|
||||
(mf/defc text-menu
|
||||
(mf/defc text-menu*
|
||||
{::mf/wrap [mf/memo]}
|
||||
[{:keys [ids type values] :as props}]
|
||||
|
||||
@ -349,8 +349,8 @@
|
||||
[:> text-options opts])
|
||||
|
||||
[:div {:class (stl/css :text-align-options)}
|
||||
[:> text-align-options opts]
|
||||
[:> grow-options opts]
|
||||
[:> text-align-options* opts]
|
||||
[:> grow-options* opts]
|
||||
[:> icon-button* {:variant "ghost"
|
||||
:aria-label (tr "labels.options")
|
||||
:data-testid "text-align-options-button"
|
||||
@ -359,6 +359,6 @@
|
||||
|
||||
(when more-options-open?
|
||||
[:div {:class (stl/css :text-decoration-options)}
|
||||
[:> vertical-align opts]
|
||||
[:> text-decoration-options opts]
|
||||
[:> text-direction-options opts]])])]))
|
||||
[:> vertical-align* opts]
|
||||
[:> text-decoration-options* opts]
|
||||
[:> text-direction-options* opts]])])]))
|
||||
|
||||
@ -171,7 +171,7 @@
|
||||
[:> blur-menu* {:type type :ids blur-ids :values blur-values}])
|
||||
|
||||
(when-not (empty? text-ids)
|
||||
[:& ot/text-menu {:type type :ids text-ids :values text-values}])
|
||||
[:> ot/text-menu* {:type type :ids text-ids :values text-values}])
|
||||
|
||||
(when-not (empty? svg-values)
|
||||
[:& svg-attrs-menu {:ids ids :values svg-values}])
|
||||
|
||||
@ -478,7 +478,7 @@
|
||||
[:> constraints-menu* {:ids constraint-ids :values constraint-values}])
|
||||
|
||||
(when-not (empty? text-ids)
|
||||
[:& ot/text-menu {:type type :ids text-ids :values text-values}])
|
||||
[:> ot/text-menu* {:type type :ids text-ids :values text-values}])
|
||||
|
||||
(when-not (empty? fill-ids)
|
||||
[:> fill/fill-menu* {:type type
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
[app.main.ui.workspace.sidebar.options.menus.measures :refer [measure-attrs measures-menu*]]
|
||||
[app.main.ui.workspace.sidebar.options.menus.shadow :refer [shadow-menu*]]
|
||||
[app.main.ui.workspace.sidebar.options.menus.stroke :refer [stroke-attrs stroke-menu*]]
|
||||
[app.main.ui.workspace.sidebar.options.menus.text :refer [text-menu]]
|
||||
[app.main.ui.workspace.sidebar.options.menus.text :refer [text-menu*]]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc options*
|
||||
@ -176,7 +176,7 @@
|
||||
{:ids ids
|
||||
:values (select-keys shape constraint-attrs)}])
|
||||
|
||||
[:& text-menu
|
||||
[:> text-menu*
|
||||
{:ids ids
|
||||
:type type
|
||||
:values text-values}]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user