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]
|
[potok.v2.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc text-align-options
|
(mf/defc text-align-options*
|
||||||
[{:keys [values on-change on-blur] :as props}]
|
[{:keys [values on-change on-blur] :as props}]
|
||||||
(let [{:keys [text-align]} values
|
(let [{:keys [text-align]} values
|
||||||
handle-change
|
handle-change
|
||||||
@ -70,7 +70,7 @@
|
|||||||
:title (tr "workspace.options.text-options.text-align-justify")
|
:title (tr "workspace.options.text-options.text-align-justify")
|
||||||
:icon i/text-justify}]]]))
|
:icon i/text-justify}]]]))
|
||||||
|
|
||||||
(mf/defc text-direction-options
|
(mf/defc text-direction-options*
|
||||||
[{:keys [values on-change on-blur] :as props}]
|
[{:keys [values on-change on-blur] :as props}]
|
||||||
(let [direction (:text-direction values)
|
(let [direction (:text-direction values)
|
||||||
handle-change
|
handle-change
|
||||||
@ -98,7 +98,7 @@
|
|||||||
:title (tr "workspace.options.text-options.direction-rtl")
|
:title (tr "workspace.options.text-options.direction-rtl")
|
||||||
:icon i/text-rtl}]]]))
|
:icon i/text-rtl}]]]))
|
||||||
|
|
||||||
(mf/defc vertical-align
|
(mf/defc vertical-align*
|
||||||
[{:keys [values on-change on-blur] :as props}]
|
[{:keys [values on-change on-blur] :as props}]
|
||||||
(let [{:keys [vertical-align]} values
|
(let [{:keys [vertical-align]} values
|
||||||
vertical-align (or vertical-align "top")
|
vertical-align (or vertical-align "top")
|
||||||
@ -126,7 +126,7 @@
|
|||||||
:title (tr "workspace.options.text-options.align-bottom")
|
:title (tr "workspace.options.text-options.align-bottom")
|
||||||
:icon i/text-bottom}]]]))
|
:icon i/text-bottom}]]]))
|
||||||
|
|
||||||
(mf/defc grow-options
|
(mf/defc grow-options*
|
||||||
[{:keys [ids values on-blur] :as props}]
|
[{:keys [ids values on-blur] :as props}]
|
||||||
(let [grow-type (:grow-type values)
|
(let [grow-type (:grow-type values)
|
||||||
|
|
||||||
@ -172,7 +172,7 @@
|
|||||||
:title (tr "workspace.options.text-options.grow-auto-height")
|
:title (tr "workspace.options.text-options.grow-auto-height")
|
||||||
:icon i/text-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}]
|
[{:keys [values on-change on-blur] :as props}]
|
||||||
(let [text-decoration (or (:text-decoration values) "none")
|
(let [text-decoration (or (:text-decoration values) "none")
|
||||||
handle-change
|
handle-change
|
||||||
@ -199,7 +199,7 @@
|
|||||||
:title (tr "workspace.options.text-options.strikethrough" (sc/get-tooltip :line-through))
|
:title (tr "workspace.options.text-options.strikethrough" (sc/get-tooltip :line-through))
|
||||||
:icon i/text-stroked}]]]))
|
:icon i/text-stroked}]]]))
|
||||||
|
|
||||||
(mf/defc text-menu
|
(mf/defc text-menu*
|
||||||
{::mf/wrap [mf/memo]}
|
{::mf/wrap [mf/memo]}
|
||||||
[{:keys [ids type values] :as props}]
|
[{:keys [ids type values] :as props}]
|
||||||
|
|
||||||
@ -349,8 +349,8 @@
|
|||||||
[:> text-options opts])
|
[:> text-options opts])
|
||||||
|
|
||||||
[:div {:class (stl/css :text-align-options)}
|
[:div {:class (stl/css :text-align-options)}
|
||||||
[:> text-align-options opts]
|
[:> text-align-options* opts]
|
||||||
[:> grow-options opts]
|
[:> grow-options* opts]
|
||||||
[:> icon-button* {:variant "ghost"
|
[:> icon-button* {:variant "ghost"
|
||||||
:aria-label (tr "labels.options")
|
:aria-label (tr "labels.options")
|
||||||
:data-testid "text-align-options-button"
|
:data-testid "text-align-options-button"
|
||||||
@ -359,6 +359,6 @@
|
|||||||
|
|
||||||
(when more-options-open?
|
(when more-options-open?
|
||||||
[:div {:class (stl/css :text-decoration-options)}
|
[:div {:class (stl/css :text-decoration-options)}
|
||||||
[:> vertical-align opts]
|
[:> vertical-align* opts]
|
||||||
[:> text-decoration-options opts]
|
[:> text-decoration-options* opts]
|
||||||
[:> text-direction-options opts]])])]))
|
[:> text-direction-options* opts]])])]))
|
||||||
|
|||||||
@ -171,7 +171,7 @@
|
|||||||
[:> blur-menu* {:type type :ids blur-ids :values blur-values}])
|
[:> blur-menu* {:type type :ids blur-ids :values blur-values}])
|
||||||
|
|
||||||
(when-not (empty? text-ids)
|
(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)
|
(when-not (empty? svg-values)
|
||||||
[:& svg-attrs-menu {:ids ids :values svg-values}])
|
[:& svg-attrs-menu {:ids ids :values svg-values}])
|
||||||
|
|||||||
@ -478,7 +478,7 @@
|
|||||||
[:> constraints-menu* {:ids constraint-ids :values constraint-values}])
|
[:> constraints-menu* {:ids constraint-ids :values constraint-values}])
|
||||||
|
|
||||||
(when-not (empty? text-ids)
|
(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)
|
(when-not (empty? fill-ids)
|
||||||
[:> fill/fill-menu* {:type type
|
[:> 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.measures :refer [measure-attrs measures-menu*]]
|
||||||
[app.main.ui.workspace.sidebar.options.menus.shadow :refer [shadow-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.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]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
(mf/defc options*
|
(mf/defc options*
|
||||||
@ -176,7 +176,7 @@
|
|||||||
{:ids ids
|
{:ids ids
|
||||||
:values (select-keys shape constraint-attrs)}])
|
:values (select-keys shape constraint-attrs)}])
|
||||||
|
|
||||||
[:& text-menu
|
[:> text-menu*
|
||||||
{:ids ids
|
{:ids ids
|
||||||
:type type
|
:type type
|
||||||
:values text-values}]
|
:values text-values}]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user